0

What is the difference between SAXParserFactory and DocumentBuilderFactory. And which one to use when?

Respectively:

javax.xml.parsers.SAXParserFactory

Selects the SAX parser. By default, org.apache.xerces.jaxp.SAXParserFactoryImpl from the XML4J library is used.

javax.xml.parsers.DocumentBuilderFactory

Selects the document builder. By default, org.apache.xerces.jaxp.DocumentBuilderFactoryImpl from the XML4J library is used.

Nuri Ensing
  • 1,899
  • 1
  • 19
  • 42
  • see: http://stackoverflow.com/questions/6828703/what-is-the-difference-between-sax-and-dom – Noel Murphy Mar 29 '17 at 12:15
  • It may be best to use neither. There are much better ways of processing XML than either SAX or DOM - examples are XSLT, XQuery, JAXB, XOM, JDOM2, StAX. If the code you're writing is going to be around for a while, read Elliotte Rusty Harold's book on processing XML in Java before making a decision. – Michael Kay Mar 29 '17 at 14:54

0 Answers0