[mercury-users] DTD parsing with XML parser

Michael Day mikeday at corplink.com.au
Wed Jun 20 11:04:07 AEST 2001

> Exporting parseInternalSubSet is not sufficient --- you'd need to
> have a separate exported predicate which does the kind of initializations
> done in document/2.

How about this:

:- pred dtd(pstate(_), pstate(dtd)).
:- mode dtd(in, out) is det.

dtd -->
    { contentStore(Content0) },
    set(gContent, Content0),
    set(gExtEntities, extEntities(init)),
    set(gEntities, entities(entities)),
    set(gPEntities, pentities(init)),
    set(gElements, elements(init)),
    set(gAttributes, attributes(init)),
    (parseInternalSubSet then (pred(_::in, pdi, puo) is det -->
        get(gEntities, entities(Entities)),
        get(gPEntities, pentities(PEntities)),
        get(gElements, elements(Elements)),
        return(dtd("Root goes here", Elements, Entities, PEntities))

I'm not quite sure what to put for the root, probably just leave it blank.
Is that predicate sufficient? It seems to work at least, I just don't
fully understand *how* it works.


mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe

More information about the users mailing list