You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xml.apache.org by Kihup Boo <kb...@programmer.net> on 2000/04/01 20:40:14 UTC

Re: How to scan/parse a DTD?

I have done this. I wrote YACC grammar and used modified
YACC to generate a Java DTD parser, which gives you the DOM
document parse tree just as if you read it from XML. Also, I wrote
a sample Java generater back-end to get the Java classes out of it.

I will send you the code once I get back to work Monday.
- Ki
----- Original Message -----
From: <mc...@us.ibm.com>
To: <ge...@xml.apache.org>
Sent: Friday, March 31, 2000 10:24 AM
Subject: How to scan/parse a DTD?


>
>
>
> Hello,
>
> I would like to be able to scan/parse a DTD for information about the
> declared elements, etc, for the purpose of generating java code/java
> classes based on the DTD specification.  I am already accomplishing this
by
> parsing a complete example xml file which is generated from the DTD (with
a
> little tweaking to catch OR relationships & multiplicities), but certain
> issues still remain, which could be solved by generating directly from
> information in the DTD.  In addition, I would like the additional
> information the DTD can provide me, such as which elements are required
vs.
> optional, etc.  Not to mention, I think it is a better, more robust, more
> elegant solution.
>
> I have been looking through the apache.xerces XML4J parser classes, and
see
> the XMLDTDScanner class, which seems (at least on the surface) to be close
> to what I want.  Could someone maybe confirm/deny this?  More importantly,
> has anyone done this?  At the moment it seems like a hell of a learning
> curve before I could actually get anywhere, so if someone could help me
> out, I would appreciate it.
>
> -Andy
>
>
> -------------------------------------------------------------------------
> Andrew B. McCullough
> Object Technology Group, IBM Global Services
> (704)594-2258                         [794-2258  TieLine]
> (704)595-2525 (FAX)             [794-2525  TieLine]
> mccull1@us.ibm.com
>
>
>
> ---------------------------------------------------------------------
> In case of troubles, e-mail:     webmaster@xml.apache.org
> To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
> For additional commands, e-mail: general-help@xml.apache.org
>
>