File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SAX or DOM to read XML

 
John King
Ranch Hand
Posts: 165
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to read a xml string and create an object to
represent the xml. Which one of sax and dom is better?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13045
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want an object in memory that represents an XML document, you have to use DOM or a related technology. SAX parsers simply scan once through a document and it is up to the programmer to hang on to the data needed.
Bill
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's a simple method for parsing a string into a DOM object. It's up to you from that point forward to create your specific object based on that DOM tree.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic