XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] Best way to create an XML document

Depends on the requirements IMO.

Creating via DOM can advantageous if further manipulation via the DOM is required. This will remove the overhead of creating a string and the initial parse to a DOM object.

If you data source is correctly encoded and standardised you can create XML documents more efficiently by using strings.

1) Creating a XML string by hand can become cumbersome, if XML is
huge. Maintaining the correct parent child relationship for a huge
document can be difficult, if done by hand (imagine a document of size
50 MB). This would lead to difficult debugging. Using a DOM API can do
this inherently in memory.

Program logic can overcome the "by-hand" issue.
 

2) It's difficult to remember correct XML name conventions if done by hand.

for e.g., <9abc> is an invalid XML name (because it starts with a number).

There are more rules for XML names.

Using DOM API does this automatically.
 
I guess this depends entirely on experience of the developer in regards to XML.

3) Using DOM API can check well-formedness of entities (like, &abc;
etc). Doing this by hand in a string can become difficult.

This certainly is a major benefit; like a interpretted language you get to see where you go wrong as you're constructing the DOM object.



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS