Altova Mailing List Archives


Reasons to use DOM when creating an XML message

From: msaladin@---.---
To: NULL
Date: 6/13/2006 12:31:00 AM

Hi all,

I'd like to list some arguments for using DOM when creating an XML
message. For me, there is only one way to create complex XMLs, that is
using DOM.

There is of course another way to create an XML, and this is to iterate
through all the objects that needs to be serialized into the XML and
then use toXML()-methods in each object instance that should appear in
the XML. In Java, you could pass a StringBuffer which will then be
filled by the toXML()-method. I think this procedure is completey
correct for small XML snippets (e.g. two or three tags with some
attributes), but it's not good to use this approach for larger and more
complex XMLs. To create larger and more complex XMLs, I would use DOM.

But this is just my gut feeling, I need to have arguments to persuade
other people. Here is a list of my arguments, but currently, the list
is rather small.

1) Special characters are handled by DOM (e.g. "<", ">", "&" etc...)
2) Char-Encodings are handled by DOM
3) XML-Schema-Validation can be used and the resulting XML can be
validated before being written to disk
4) It's easier to change the XML layout in the future, because the
order in which you serialize the objects to XML does not matter with
DOM.

Any other arguments?
Thank for your help.

Michael

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.