• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

DOM and SAX

 
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DOM and Sax both are simple API for XML. So what is the difference between the two and how I'll come to know which one is useful for me?
thanks
shivani
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi shivani:
Sax is sequential reader, dom retains the whole object tree in memory. Both are fine for reading small documents, but if you need to read a large document, you may run into memory problems with DOM. Additionally, if you also want to change the data you are reading, then DOM is the way to go as SAX does not provide an easy way to do this.
If you are building an application in java, then i would recommend jdom as the way to go (http://www.jdom.org) as it combines best features of dom and sax.
yatin
[This message has been edited by yatin thakore (edited March 27, 2001).]
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
Well the main difference between DOM ans SAX is that
SAX is Event driven and DOM first builds a tree and then traverse the tree node by node. Plus what Yatin has added.
 
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This link might help!
http://www.xml-zone.com/articles/sf020101/sf0201-2.asp
Thanks,
Hema
 
shivani anand
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you everyone for replying. I am totally new with this topic. I need parser to comile my XML programmer? Can I download it from internet? Can anyone give me some idea how to compile and run XML?
shivani
 
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can download the whole Sax 2.0 API from http://www.megginson.com/SAX
 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
shivani ,
XML is not a program or an executable image, so it cannot be run.
XML is a way of representing (hierarchical) data. It is text based, has extensive vendor support and parsers are available in various popular languages.
There are dozens of free tutorials available on the web that will help you catchup with this technology. Checkout the all new JavaranchXML links repository for an extensive collection of XML resources.
Cheers

------------------
Ajith Kallambella M.
Sun Certified Programmer for the Java�2 Platform.
IBM Certified Developer - XML and Related Technologies, V1.
 
Hema Menon
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shivani,
If you are wondering about which parser to choose, read the article provided in this link
http://www.javaranch.com/ubb/Forum31/HTML/000553.html

You can get JAXP from Sun's website http://www.java.sun.com/xml/download.html
Apache Xerces is available for Java and C++ from http://xml.apache.org/
JDOM is available at http://www.jdom.org
Hope this helps,
Hema
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!