[mercury-users] DTD parsing with XML parser

Thomas Conway conway at cs.mu.OZ.AU
Tue Jun 19 11:20:40 AEST 2001

On Tue, Jun 19, 2001 at 10:37:58AM EST, Michael Day wrote:
> Hi,
> Is it possible to use the XML parser to parse DTD files? (a file
> consisting solely of the internal subset of a DTD, I think). The only
> public parsing predicate in xml.parse appears to be document, would it be
> necessary to also export parseInternalSubSet?

If you include a reference to an external DTD in the DOCTYPE decl,
then it gets parsed. So, a simple way to get a dtd would be
to create an entity:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE foo SYSTEM "mydtd.dtd">
Then parse that.

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

  Thomas Conway )O+
 <conway at cs.mu.oz.au>       499 User error! Replace user, and press any key.
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