XML and DTD pasring

James Grimm (david@megginson.com)
Mon, 19 Oct 1998 11:37:45 -0400 (EDT)


Sung Nguyen writes:

> With IBM Alpha Parser, It is working fine with
> both DTD and XML in the same files. But, when I have
> DTD in a separated file stored in a buffer - also the
> XML file is stored in a buffer too. The parser doen't
> provide the API to do that job.

I haven't tested the SAX support in XML4J recently, but if it supports
EntityResolvers correctly, you can simply make up a URI for the
external DTD, and then supply your own Reader for the buffer when you
see the URI.

For more information, see

http://www.megginson.com/SAX/javadoc/org.xml.sax.EntityResolver.html

It is possible to use entity resolvers in quite clever ways -- you can
also pull information out of a database, request user input in a
dialog box, etc. I wish that I could take credit for the idea, but I
think that the original suggestion came from James Clark.

All the best,

David

-- 
David Megginson                 david@megginson.com
           http://www.megginson.com/