xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrews, Scott" <Andre...@ctcnsc.org>
Subject RE: How do I parse a DTD in Java?
Date Tue, 13 Jan 2004 20:25:44 GMT
This is very helpful information, and I'm glad I signed onto this list.

I will try this, if my current attempt fails.  So far, it looks like XML
Schema Object Model (XSOM), put out by the Sun Microsystems developer
crowd, will work for me:

http://developers.sun.com/dev/coolstuff/xml/readme.html

First, you need to convert your DTD to XML Schema.  Then you can parse
the XML Schema with the XSOM API.  The examples are quite clear.

I figure, with the XSOM approach, the code I write is forward
compatible, with future XML structure.

If this should fail, it's good to know there is a fallback to parsing
DTDs.

Many thanks for your thoughts!!!

  _____  

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: Henry Miller [mailto:hmiller@eti.com] 
Sent: Tuesday, January 13, 2004 2:26 PM
To: general@xml.apache.org
Subject: Re: How do I parse a DTD in Java?

Absolutely!  I'm using it already. It might be a little tricky, I had 
to do a lot of trial and error to figure out the pieces I wanted 
(there's not much in the way of Docs about using Xerces in this way), 
but the point is it *can* be done. I was able to pull out <!ELEMENT > 
declarations and their attributes, etc. and write output files based 
on this data.

I forget the name, but there's a good sample program in the Xerces-J 
directory to get you started.

Depending on what you want to do, it might be more than you need. All 
solutions offered up so far have been very good ones -- I just 
noticed that this one wasn't offered.

At 8:12 PM +0100 1/13/04, Paul Libbrecht wrote:
>On 13-Jan-04, at 19:00 Uhr, Henry Miller wrote:
>>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
>
>Last time I read this, it wasn't working for DTDs (i.e. you could 
>pre-parser them but you couldn't inspect them). Can DTDs be 
>inspected by Xerces now ?
>
>Thanks.
>
>Paul
>

-- 


--Henry


---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.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