[jdom-interest] generate XML conformly to dtd

Mauerwerk, Mark Mark.Mauerwerk at gopa.de
Thu Feb 14 06:39:22 PST 2002


I'm developing a sort of XML generator which shall build up a XML
document from the scratch but conformly to a DTD. While I found the
first task quite simple to build XML documents from the scratch with
JDOM, it seems more difficult to do this in a more generic way conformly
to a DTD (e.g retrieving a DOM object from a DTD, put the data values
from an arbitrary data source in and build the XML document).

I think a DTD parser could be heplful to support that work but it seems
that the most common packages supporting XML don't support that way
(extracting a document structure from a DTD). 

My method of resolution is to use schema instead: e.g. parse the schema
(i.e. get the structure and constraints), vailidate the data from any
data source (represented by Java data) and build the document containing
the validated Java data with the structure derived from the schema.

But, I think a generic XML generator is a very common approach in
practice and may be I have overseen something already existing. So whats
your experience with similar approaches.

Thanks in advance

More information about the jdom-interest mailing list