xmlcertification
Table 1. Advice on XML use
Characteristic || Discussion || Advice
Output targets and formats (PDA, browser, iPod, PDF) | The more types of output, the more benefit from XML transformation. | Use XML when multiple output formats are required. Content size | The larger the content, the more performance hurdles you'll have to overcome using XML. This leads to consideration of alternatives, such as compression, or another format entirely, such as Abstract Syntax Notation One (ASN.1), which loses the human readability benefit. | Use XML when messaging and processing efficiency is less important than interoperability and availability of standard tools. Interoperability | XML's greatest strength is arguably its cross-language, cross-platform format that diverse systems can understand. | Use XML when you must communicate with diverse systems. Searching | XML supports relatively simple queries through XPath and more complex queries with the more recent XQuery. While maturing, XML technologies have been relatively weaker at searching. It is yet to be seen if XML-aware databases can help with this, since they store the XML in a tree structure. See XML-aware databases. | Don't use XML documents when searching is important. Instead, store the content in a database or use an XML-aware database. Summarizing | XML technologies are weak at summarizing data -- for example, for reports. See XML-aware databases. | Don't use XML documents when summarization is important. Instead, store the content in a database or use an XML-aware database. Project size | To use XML, you need a parser and code to deal with the XML events or tree. | For small projects with simple requirements, you might not want to incur the overhead of XML.
SAX and DOM
- Merging documents This certainly requires working with a DOM tree. It hurts my head to think about doing this tag-by-tag using SAX.
- Small devices If memory is a premium, SAX uses very little. DOM must build a tree structure of the entire document.
- Looking for certain tags If a certain event is to happen whenever a certain tag occurs, SAX will work nicely.
- Complex manipulation If changes to different parts of the document are required based upon values from other portions of the document, then it will most likely be easier to use the DOM parser.