Lecture 7 & 8 DOM & SAX Flashcards

1
Q

What are the advantages and disadvantages of DOM & SAX? (PART 1)

A

DOM

  1. •Unless you build a DOM style tree from your application’s internal representation for the data, you can’t as easily write the XML file back to disk.

VS

SAX

  1. •If you use DOM to construct the tree, extract the data and throw away the tree, then SAX might have been more efficient.
  2. •If you convert the data in the DOM tree to another format, the SAX API may help remove the intermediate step.
  3. •If you do not need all the XML data in memory, the SAX API allows you to process the data as it is parsed.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the advantages and disadvantages of DOM & SAX? (PART 2)

A
  1. DOM has a Tree of Nodes Vs SAX that works with a Sequence of events
  2. DOM occupies more memory so its preffered for small XML documents Vs SAX which doesn’t use any memory, preffered for large documents
  3. DOM has a slower runtime Vs SAX with faster run time
  4. DOM is stored as objects Vs SAX objects are to be created
  5. DOM is programmtically easy, since it has objects already Vs SAX where you need to write code for creating Objects
  6. DOM is easy to navigate with a tree Vs SAX where backwards navigation is not possible as it sequentially processes the document
How well did you know this?
1
Not at all
2
3
4
5
Perfectly