[XML-SIG] Parsing DTDs

Lars Marius Garshol larsga@garshol.priv.no
12 Feb 2001 12:05:31 +0100


* Guenter Radestock
| 
| 2. There is a DTD parser inside xmlproc. 

Yup. It is documented at 
  <URL: http://www.garshol.priv.no/download/software/xmlproc/ >

This documentation should also be in the XML-SIG CVS.

| This seems to be pretty closely coupled to the validating XML
| parser.

It is not. The DTD API consists of two parts: an event-based parser
and an object structure for representing DTDs that also implements
the application interface of the event-based parser.

The event-based parser is not tied to the validating XML parser at
all. The DTD structure needs a reference to the event-based parser to
produce error messages. This is a weakness of the current design, but
shouldn't really cause any problems for your application.

| At first sight it looks like it gets very low level DTD events and
| generates finite state automata objects among other things used to
| validate XML later on.  It looks like there is no intermediate
| representation of the DTD that can (or should) be used for other
| purposes than validating XML.  Is this correct?

Yes, it is.  Look at the xmldtd module.  That contains the object
structure that is built by the parser.  The finite state automata are
used by the ElementType objects, and are hidden within their
interface.  You can get access to the information in them, but no the
automata themselves.

Do let me know if you have problems with the interface in any way.

--Lars M.