M
msaladin
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
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