writing xml is not as easy as it looks

Kay Michael Michael.Kay at icl.com
Mon Jun 28 11:04:55 BST 1999


> programmatically, i have to write an xml document that must 
> be validated against a given dtd.  i do not even know where to begin.. i
could, of
> course, use the FileWriter to write to an ascii file, but 
> there must be a better way!  is it possible for me to construct an xml
document in
> memory (using the DOM packages? the SAX packages?)

Many of the DOM packages allow you to create a DOM in memory and then
serialise it as an XML document, though this isn't actually part of the DOM
definition, and the way you reference a DTD may vary from one package to
another.

But in my experience I've found it easier to write the XML directly to an
output file than to build the DOM structures. Probably the only benefit of
going via the DOM is that it will handle character encoding and escaping for
you.

Mike Kay

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)





More information about the Xml-dev mailing list