GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Placement Papers  >  Oracle  >  Java

 Print  |  
Question:  Difference between SAX and DOM?




December 12, 2005 12:06:45 #4
 Habeeb Mohmed   Member Since: Visitor    Total Comments: N/A 

RE: Difference between SAX and DOM?
 

SAX Historical Background

! Simple API for XML

! Started as community-driven project

  "xml-dev mailing list

! Originally designed as Java API

  "Others (C++, Python, Perl) are now

supported

! SAX 2

  "Namespaces

 

SAX Features

! Event-driven

  "You provide event handlers

! Fast and lightweight

  "Document does not have to be entirely in memory

! Sequential read access only

! One-time access

! Does not support modification of document

 

 

Historical Background

l DOM is a standard defined by the

W3C, just like XML

l DOM was not designed specifically for

Java technology (unlike SAX)

l DOM is cross-platform and crosslanguage

uUses OMG’s IDL to define interfaces

uIDL to language binding

 

DOM Characteristics

l Access XML document as a

tree structure

l Composed of mostly element nodes

and text nodes

l Can “walk” the tree back and forth

l Larger memory requirements

uFairly heavyweight to load and store

l Use it when for walking and modifying

the tree

     

 

Back To Question