[Home] [By Thread] [By Date] [Recent Entries]
> I don't want to have to hard-code a different method for every XML > document I'm building. Is there a way to "parse" a DTD and then build > the XML as I iterate over the DTD? Or perhaps a tool or utility that > makes this easier? Or even some way to check before/during adding an > element whether it is valid for that DTD? Thanks, Wendi Most SAX2 parsers expose all the important DTD information [1, 2, 3]. You can save that information and use it later. Depending on how you save your DTD and document data, you may be able to validate your data at any time by turning your data into SAX events [4]. - Dave [1] http://sax.sourceforge.net/apidoc/org/xml/sax/ext/DeclHandler.html [2] http://sax.sourceforge.net/apidoc/org/xml/sax/ext/LexicalHandler.html [3] http://sax.sourceforge.net/apidoc/org/xml/sax/DTDHandler.html [4] http://www.gnu.org/software/classpathx/jaxp/apidoc/gnu/xml/pipeline/ValidationConsumer.html
|

Cart



