I have an file which contain XML tags and the name of the file is abc.xml,I just want to know which is the best IO technique that I should use to read that xml file means memory mapped IO , buffered reader and which one is fastest to read xml file through a java program.
2 Answers
There are two main schools of parsing XML files: using SAX and JAXP. SAX is a stream oriented parsing technique. It means that you read a file tag after tag and can't go backward. It's quite simple and fast but using it to realize more advanced tasks might be difficult. JAXP on the other hand represents the document as an object tree (DOM structure). It's slower and needs more memory but it's often easier to use in complex manipulation of XML files. Knowing both techniques is the software-engineer's 'must know'.
2 Comments
lbalazscs
it's SAX and DOM, not SAX and JAXP. JAXP includes both SAX and DOM (and others). en.wikipedia.org/wiki/Java_API_for_XML_Processing
techuser soma
JAXP is not DOM. JAXP is a set of API that provides parsers supporting both SAX and DOM.