Matra - a DTD parser

It started in '99 when I started representing the DTD structures that I was working on in a Tree format. When I felt the need to automate the generation of the DTDTree, I could not find a suitable DTD parser ... so I wrote my own. Find it at Matra DTD Parser.

Sunday, September 14, 2003

Matra - a DTD parser
(http://matra.sourceforge.net)

Back in '99 I came up with a Tree structure for me to visualize my DTDs. The concept is simple and helps to visually see the structure of the DTD - albeit a bit simplified than the actual structure.

For instance,

for the DTD

<!ELEMENT root (firstChild, secondChild*, lastChild?)>
<!ATTLIST root
version CDATA #FIXED
>

<!ELEMENT secondChild (#PCDATA)>

<!ELEMENT lastChild (#PCDATA)>

<!ELEMENT firstChild (#PCDATA)>


the tree structure will look like


root (version="1.0")
|
|- firstChild
|
|- secondChild*
|
+- lastChild?

The DTDTree will show the parent-child relationship between the elements and the attributes associated with the elements. Note that it doesn't show any complex content specifications that the DTD specifications (or rather the XML specifications) allow - but simplifies the structure for easier digestion.

By 2000 I wanted to automate the creation of the DTDTree, but could not find a DTD Parser (in java) that I could readily use. So I went about creating my own. The initial parser was written keeping the DTDTree in mind, but its evolved over time to be usable for other purposes - and it continues to evolve.

The Matra project started as being centered on the DTDTree and then on the DTD Parser, I forsee it to have the parser core with a lot of utilities built on top of it. Lets see how it goes!

You can get the code for the Matra DTD Parser and utilities at sourceforge - at http://matra.sourceforge.net.