hey friends,
i have been assigned a query planning project.
in this project if enter an sql like query, which i have to slice and turn into an xml.
i did this part, however i am required to add a DTD for this xml, because as the project mentions it helps to parse (using java DOM) this query and find easily the selection – duplicates and joins specified in the query.
i don’t understand, how does a DTD help while using DOM to parse the xml and find the different parts of this xml?
i could use DOM to find the different parts of the xml without a dtd… Can anybody give me and example of the difference?
thanks
A DTD tells the parser which tags are allowed, and where in the document they should be expected. Without a DTD, the parser will read the tags but it won’t know if the tag was an expected one, or if it was in the right place.
If you parse your XML with SAX or DOM, it doesn’t matter, neither parser will know if your tags are expected or unexpected without a DTD (or one of it’s more recent replacements like XSD, RelaxNG, etc).