Parser for DTDs

francis francis at
Tue Apr 21 18:05:33 BST 1998


Matt Mower wrote:
> Hi.
> I am looking for a java parser that when fed a DTD returns a model
> representing all the valid documents that can be expressed using that
> DTD, i.e. for any given element type I need to be able to determine what
> are valid sub-elements/attributes/content. One additional constraint is
> that I need to parse the DTD outside of the context of an XML document.

I can recommend Aelfred from - it gives your program
callbacks which get called for DTD events like new element and tag
definitions as well as the expected XML events. There is a nice simple program which you can hack to slap things into a Swing

Aelfred parses the DTD from the XML document however - if you need to
parse the DTD directly then the IBM parser certainly mentions this
feature in its documentation, the Microsoft one also mentions it as
available via a slightly non-recommended direct access to the the parser
object. I haven't used either yet...

Hmmm - just cut and pasted IBM's command line DTD demo from the
codumentation into a DOS box

	jre -cp "xml4j.jar" GeneratingSample personal.dtd

and it worked straight off - nice...


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at
Archived as:
To (un)subscribe, mailto:majordomo at the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at

More information about the Xml-dev mailing list