Both of them seem to have the same purpose (create a XMLReader). Some Tutorials contain the one, some the other.
SAXParserFactory:
- http://docs.oracle.com/javase/7/docs/api/javax/xml/parsers/SAXParserFactory.html
- seems to be more configurable
- more boiler-plate code
- officially supported api
example code:
// SAXParserFactory
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser parser = factory.newSAXParser();
XMLReader reader = parser.getXMLReader();
reader.parse(new InputSource("document.xml"));
XMLReaderFactory:
- http://docs.oracle.com/javase/7/docs/api/org/xml/sax/helpers/XMLReaderFactory.html
- two lines less code
- less configurable
- comunity supported and comes with no waranty
example code:
// XMLReaderFactory
XMLReader xmlReader = XMLReaderFactory.createXMLReader();
xmlReader.parse(new InputSource("document.xml"));
question:
Are these the main differences or are there some i've overseen.
Which one should you choose?