Possible Duplicate:
Comparison of XML parsing APIs on the Java SE platform
I am trying to code an XML parser using Java and for that there's a lot of API that treat xml such as sax, jdom, xerces, ... and I did not know which one to use.
Possible Duplicate:
Comparison of XML parsing APIs on the Java SE platform
I am trying to code an XML parser using Java and for that there's a lot of API that treat xml such as sax, jdom, xerces, ... and I did not know which one to use.
There are three API choices and for each of them are multiple implementations available
SAX (Simple API for XML) in this model the parser calls callback functions you have to supply for each element or attribute it encounters. The SAX API is read only, you will need an other API for writing.
DOM in this model the parser generates a DOM which is a hierarchy of objects representing the structure of the XML document. This method can require lots of memory for large documents and the DOM tree isn't that easy to use. It most useful when you have to handle documents with unknown contents. The DOM can both be read and written.
JAXB allows you to use your own objects and by annotating them you can map your objects to XML. It can both read and write. This one requires the least amount of code.