The Infovis Contest DTD
The full dtd can be found here: A local copy of the DTD
<!ELEMENT tree (declarations?, (branch | leaf)* )>
This line says that there is an element (Elements are the main building blocks of both XML and HTML documents) with the name tree. It has children of type declarations (have to come first) and of type branch or leaf. The * sign in the example above declares that the child elements branch or leaf can occur zero or more times inside the tree element. The ? sign in the example above declares that the child element declarations can occur zero or one times inside the tree element.
<!ATTLIST tree
version CDATA #FIXED "1.0" src CDATA #IMPLIED desc CDATA #IMPLIED date CDATA #IMPLIED author CDATA #IMPLIED >
In the DTD, XML element attributes are declared with an ATTLIST declaration. CDATA stands for character data. The first line states that this is the attribute list for the tree element. It contains an attribute named version which is of type CDATA and has a default value of 1.0. #FIXED stands for a fixed attribute value and #IMPLIED stands for an attribute that does not have to be included.
<!ELEMENT declarations (attributeDecl+)>
This line declares an element called declarations. It has a child called attributeDecl.
The + sign in the example above declares that the child element message must occur one or more times inside the note element.
<!ELEMENT attributeDecl EMPTY>
This line declares the child element of declarations called attributeDecl. It does not have any children.
<!ATTLIST attributeDecl
name CDATA #REQUIRED type (Int|Integer|Long|Float|Real|String|Date|Category) "Int" control CDATA #IMPLIED >
The attribute name is of character data and is required. The attribute type can have many different types, Int, Integer, Float, ... The default value is "Int". The attribute control is of character type and does not have to be included.
<!ELEMENT branch ( attribute*, (branch | leaf)* ) > The element branch can have 0 or more children of type attribute or zero or more children of type branch or leaf.
<!ATTLIST branch
label CDATA #IMPLIED >
The element branch has an attribute called label. It does not have to be there since it is an implied value.
<!ELEMENT leaf (attribute*) > The element leaf can have zero or more children of type attribute.
<!ATTLIST leaf
label CDATA #IMPLIED >
The element leaf can have an attribute named label with character data included.
<!ELEMENT attribute (#PCDATA) > The element attribute can contain #PCDATA. PCDATA means that the element contains data that IS going to be parsed by a parser.
<!ATTLIST attribute
name CDATA #REQUIRED value CDATA #REQUIRED >
The attributes for the element atrribute contain a required field of type name and a required field of type value.
Here is a small example:
<?xml version="1.0" standalone="no"?> <!DOCTYPE tree SYSTEM "http://www.cs.umd.edu/hcil/iv03contest/datasets/treeml.dtd"> <tree> <declarations> <attributeDecl name="name" type="String"/> <attributeDecl name="number" type="Real"/> <attributeDecl name="type" type="String"/> </declarations> <branch> <attribute name="name" value="sample things"/> <branch> <attribute name="name" value="plants"/> <leaf> <attribute name="name" value="oak"/> <attribute name="number" value="10"/> <attribute name="type" value="wild"/> </leaf> </branch> </tree>