A Technology Blog About Code Development, Architecture, Operating System, Hardware, Tips and Tutorials for Developers.

Friday, November 16, 2012

XML Parsing using Java

7:22:00 PM Posted by Satish , 1 comment

There are lot of APIs  available in market to parse XML to object. I am going to demonstrate few APIs which comes along with JDK 6. Mostly XMLs are used in application, when there is application to application interaction required. In order to use XML in applications and to reduce development cost developers use XML computation APIs. 


The DOM interface is the easiest XML parser to understand, and use. It parses entire XML document and loads it into memory; then models it with Object for easy traversal or manipulation.



SAX parser is work differently than DOM parser, it neither load any XML document into memory nor create any object representation of the XML document. SAX provides an Event-Driven XML Processing following the Push-Parsing Model.



Streaming API for XML, called StaX, is an API for reading and writing XML Documents. StaX is a Pull-Parsing model. Application can take the control over parsing the XML documents by pulling (taking) the events from the parser. 



JAXB, stands for Java Architecture for XML Binding, using JAXB annotation to convert Java object to / from XML file.

1 comment:

  1. Certainly for xml work i prefersax based parsers which ae much faster.

    ReplyDelete