in reply to Re: RFC : XML::Generator::FromDTD
in thread RFC : XML::Generator::FromDTD

hagus sez :
Out of interest, how can a DTD help me? What does it bring to the table?


I'll quote from the introduction to Learning XML, since it's got a good concise explanation :

Unambiguous Structure

XML takes a hard line when it comes to structure. A document should be marked up in such a way that there are no two ways to interpret the names, order and hierarchy of the elements. This vastly resudces errors and code complexity. Programs don't have to take an educated guess or try to fix syntax mistakes the way HTML browsers often do, as there are no surprises of on XML processor creating a different result from another...
The DTD is a blueprint for document structure. An XML schema can restrict the types of data that are allowed to go inside elements...
So, before you start writing an XML document, you should consult the corresponding DTD so you know which tags can accept what attributes, and what those attributes should be, which tags need to be empty and so on. When your XML document is parsed, it gets (should get?) validated against whatever DTD is found in the doctype declaration.
My hope was that, by creating a module that created an object whose methods complied to (or mostly to, I wanted to run it by pm first and see if the idea was viable) a DTD, I could time & effort debugging later on down the road.