OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DTD formal syntax





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
> 

Hi,

	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
cases.
My proggy is not open source, but get the grammar at
http://www.jnerd.de/sneak/DTDParser.jj . 
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.

CU,

	PAtrick
begin:vcard 
n:Ohl;Patrick
tel;cell:+49-1708607430
tel;home:+49-89-38859084
tel;work:+49-89-358680-45
x-mozilla-html:FALSE
url:http://www.jNerd.de
adr:;;Ainmillerstr. 6;Munich;;80801;Germany
version:2.1
email;internet:Patrick.Ohl@o-h-l.de
fn:Patrick Ohl
end:vcard