[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: DTD formal syntax
- From: Patrick Ohl <Patrick.Ohl@o-h-l.de>
- To: Jim Mehl <email@example.com>, "firstname.lastname@example.org" <email@example.com>
- Date: Fri, 08 Jun 2001 11:46:45 +0200
Jim Mehl wrote:
> Thanks for the responses, but I didn't explain myself very well. I'm
> looking for a form of the syntax that is closer to what a parser
> generator might expect. Sounds like I might have to do what
> Bob DuCharme suggested (pull it out of the XML version of the
> XML spec).
> I want to write something that accepts a DTD, allows you to input
> data that conforms to the DTD, and outputs the data in valid XML.
> XMLSpy does this, but not quite the way I would like.
> Jim Mehl
I use a JavaCC Grammar to parse a DTD. I wrote it myself, or stricly
speaking, copied it from the XML Specs. It works, but fails in rare
My proggy is not open source, but get the grammar at
This is the raw version of the grammar (the one I use in XML2Java (
http://www.jNerd.de/xml2java.html )). I didn't edited the line you do
not need. But maybe it is a better example how to use it then.
There are certain restrictions though. The grammar does not accept
comment. I filter them before pipeing the stream to the parser.
Note that you need JavaCC2.0 (
http://www.webgain.com/products/metamata/zip_files/JavaCC2_0.zip ) for
building the code.
Use the grammar freely, but please report any bugs, enhancements or
comments ( mailto:DTDGrammar@jNerd.de ).
I hope it helps you.