xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Clark <an...@apache.org>
Subject Re: DTD Parsing with xerces
Date Thu, 30 Jun 2005 00:26:52 GMT
Vijay Dialani wrote:
> I was trying to use XERCES for parsing a DTD document. There seems to
> be more than one way to accomplish the above. For my purpose, I was
> able to extend the org.apache.xerces.parsers.DOMParser class and
> override the DTD associated methods, but these do not provide the

The problem with that approach is that you are not able
to parse a standalone DTD file -- only a DTD that is part
of an XML document.

> advanced features as those provided by
> org.apache.xerces.parsers.DTDParser. Does any know a way of how one
> could use org.apache.xerces.parsers.DTDParser class? Any Sample code?

You could use the DTDParser class directly but it might
require you to write more code than you want. Another
approach is to use my NekoDTD[1] tool. It basically makes
the DTDParser into an XML parser, reporting all of the
DTD information in XML format. So you can use standard
XML APIs like DOM and SAX to access the DTD grammar.

This also lets you apply XSLT stylesheets and anything
else that you can do with XML. In fact, the tool comes
with some stylesheets (and some handy .bat files) to do
a poor-man's conversion of DTDs into XML Schema and
RelaxNG.

Depending on what you want to do, NekoDTD may help.

[1] http://www.apache.org/~andyc/neko/doc/dtd/index.html

-- 
Andy Clark * andyc@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org


Mime
View raw message