You might also want to check out the "Preparsing Grammars"
section in the Xerces2-J FAQ. It has a wealth of info you could
try...
Preparsing grammars deals explicitly with reading a DTD (or XSD)
and storing the data in a grammar which you can walk through to get
the DTD pieces you're interested.
http://xml.apache.org/xerces2-j/faq-grammars.html#faq-3
Hope this helps.
--Henry
At 12:39 PM -0500 1/13/04, Gus Heck wrote:
You could extract a copy of the DTD by inspecting the input before you parse it and write your own DTD parser... I don't personally know of software that parses DTD's directly though, Google of "parse a DTD" shows that there is a perl module for this sort of thing I think:
http://search.cpan.org/~phish/XML-LibXML-1.53/lib/XML/LibXML/Dtd.pod
and a java lib:
http://www.wutka.com/dtdparser.html
I also saw something that seemed to talk about a C lib for it in that search....
Google knows all :)
-Gus
Andrews, Scott wrote:
I think you may misunderstand my question? I'm looking to parse the DTD
- not the XML.
_____
Scott Andrews
Principle Software Engineer
Concurrent Technologies Corporation
(814) 269 6580 (Monday, Wednesday, Friday)
(814) 632 9559 (Tuesday, Thursday)
(814) 880 8522 (Cell)
-----Original Message-----
From: Paul Libbrecht [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 13, 2004 11:35 AM
To: [EMAIL PROTECTED]
Subject: Re: How do I parse a DTD in Java?
Many many many possibilities:
- JDOM
- DOM
- SAX
- Commons Digester
- .... just about ten thousand more...
Really don't need JAXB there which is artillery for people fearing to look at XML, to my taste.
Paul
On 13-Jan-04, at 16:42 Uhr, Andrews, Scott wrote:
I need something dynamic, where the structure of the XML document is
unknown until parse time, as if the user specifies the DTD. I want
to,
at run-time, iterate over the structure and provide the user with
actions to be taken when those elements are encountered in the XML
documents.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
--Henry