[jdom-interest] Parsing DTDs With JDOM?

Brett McLaughlin brett.mclaughlin at lutris.com
Sun Jul 16 18:38:23 PDT 2000

Jon Baer wrote:
> Im in the middle of something and trying to figure out how exactly to
> parse a DTD or to find a lib that can do it.  Basically what I want to
> do is grab all the elements from the DTD and their related attributes,

Parsing a DTD is a non-standard activity, and can't be done through DOM
or SAX in a vendor-neutral way. The Lexical Handler in SAX will help,
although you won't get constraints, just entity references and such.

Apache Xerces has some sort of GrammarAccess class (something like that
- I forget, and am too tired to look). It parses a DTD, but again, not
in any vendor-neutral way.

> Im trying to think if this is going to be a tideous process if I have to

Yup - DTDs aren't XML, so an entirely different "parser" behavior has to
be coded. It's a real pain - part of why XML Schema is nice ;-) (albeit

> do it myself or if someone on the list has experience with doing such a
> thing.

Long time ago ... if you do it, I'm more than happy to include it as
part of JDOM - perhaps a org.jdom.dtd or something like that branch... I
don't know, I'm thinking aloud.

> I want to be able to run the parser on a DTD and write out a map file
> for an IDE im using as such:
> <map>
> <element>
> <name>Foo</name>
> <attribute required="false">Bar1</attribute>
> </element>
> </map>
> Anyone have thoughts on how to accomplish this?  Can it be done with
> JDOM directly?

Not today, although it would be very cool to have... It would also be
nice for validation, when we add all that in.


> Thanks.
> - Jon
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com

Brett McLaughlin, Enhydra Strategist
Lutris Technologies, Inc. 
1200 Pacific Avenue, Suite 300 
Santa Cruz, CA 95060 USA 

More information about the jdom-interest mailing list