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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: [xml-dev] Parsing a DTD

[ Lists Home | Date Index | Thread Index ]

Title: Message
Hi Terry,
 
If you are looking for java classes to parse the DTD you could try matra[1]. You can parse standalone DTDs or DTDs with multiple modules included within it.
 
Disclaimer: The code is around 3 years old and is in an alpha state. It works on most DTDs, but there might be a few bugs here and there. I had planned to fix them, but never got down to doing it ... If you face a problem with the code feel free to contact me.
 
You'll also find DTDTree in the project. It displays the structure of the DTD is a simple (or simplistic!!) tree structure [2] - showing the parent-child relationship between the elements. I find it pretty useful while trying to decipher the structure of a DTD.
 
[1] You can find matra at -
 
[2] Here a snippet of an eg tree ...

schema (targetNamespace, version, xmlns="http://www.w3.org/1999/XMLSchema", finalDefault="", blockDefault="", id, elementFormDefault="unqualified", attributeFormDefault="unqualified")

|

|- include (schemaLocation)

|  |

|  +- annotation

|     |

|     |- appinfo (source)

|     | 

|     +- documentation (source, xml:lang)

|       

|- import (namespace, schemaLocation)

|  |

|  +- annotation

|     |

|     |- appinfo (source)

|     | 

|     +- documentation (source, xml:lang)

|       

|- annotation

|  |

|  |- appinfo (source)

|  | 

|  +- documentation (source, xml:lang)

...

 

cheers
Conrad
-----Original Message-----
From: Terry Chilvers [mailto:terrychilvers@bpp.com]
Sent: Wednesday, July 23, 2003 1:22 AM
To: xml-dev@lists.xml.org
Subject: [xml-dev] Parsing a DTD

Hi,
I would like to parse/process a DTD in order to extract, for each element, a list of available/valid child elements and attributes.
I've been looking through the MSXML4.0 reference and can't see anything that looks like it would help. I've also spent several hours searching the web looking for example code and tools, but no joy.
The DTD in question (at the moment anyway) is DocBook, but I want something generic. DocBook seems to use quite a few seperate files for the DTD, so I'd need to be able to handle this.
 
Any suggestions for code or tools, or pointers in the right direction or even alternative methods would be greatly appreciated.
 
Thanks in advance.
Terry Chilvers




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS