Home arrow XML arrow Page 8 - XML Parsing With DOM and Xerces (part 2)

Black Or White - XML

In this concluding article of a two-part series, use your knowledge of DOM processing with Xerces to construct simple Web applications based on Xerces, XML and JSP. Examples include transforming an XML file to HTML via Xerces and dynamically generating an XML document tree from a MySQL database.

TABLE OF CONTENTS:
  1. XML Parsing With DOM and Xerces (part 2)
  2. The Writing On The Wall
  3. Highlights
  4. Data Overload
  5. Oops!
  6. Dear Diary
  7. Of Method And Madness
  8. Black Or White
  9. Link Out
By: icarus, (c) Melonfire
Rating: starstarstarstarstar / 9
March 06, 2002

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement
Now, you can parse a document using either DOM or SAX, and achieve the same result. But which is better?

As with all complex questions, there's no simple answer.

The SAX approach is event-centric - as the parser travels through the document, it executes specific functions depending on what it finds. Additionally, the SAX approach is sequential - tags are parsed one after the other, in the sequence in which they appear. Both these features add to the speed of the parser; however, they also limit its flexibility in quickly accessing any node of the DOM tree.

As opposed to this, the DOM approach builds a complete tree of the document in memory, making it possible to easily move from one node to another (in a non-sequential manner). Since the parser has the additional overhead of maintaining the tree structure in memory, speed is an issue here; however, navigation between the various "branches" of the tree is easier. Since the approach is not dependent on events, developers need to use the exposed methods and attributes of the various DOM objects to process the XML data.

The DOM parser is a little slower, since it has to build a complete tree of the XML data, whereas the SAX parser is faster, since it's calling a function each time it encounters a specific tag type. You should experiment with both methods to see which one works better for you.

 
 
>>> More XML Articles          >>> More By icarus, (c) Melonfire
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

XML ARTICLES

- Google Docs and Xpath Data Functions
- Flex Array Collection Sort and Filtering
- The Flex Tree Control
- Flex List Controls
- Working with Flex and Datagrids
- How to Set Up Podcasting and Vodcasting
- Creating an RSS Reader Application
- Building an RSS File
- An Introduction to XUL Part 6
- An Introduction to XUL Part 5
- An Introduction to XUL Part 4
- An Introduction to XUL Part 3
- An Introduction to XUL Part 2
- An Introduction to XUL Part 1
- XML Matters: Practical XML Data Design and M...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: