The javax.xml.parsers package defines four classes supporting the processing of XML documents:
|SAXParserFactory||Enables you to create a configurable factory object that you can use to create a SAXParser object encapsulating a SAX-based parser|
|SAXParser||Defines an object that wraps a SAX-based parser|
|DocumentBuilderFactory||Enables you to create a configurable factory object that you can use to create a DocumentBuilder object encapsulating a DOM-based parser|
|DocumentBuilder||Defines an object that wraps a DOM-based parser|
All four classes are abstract. This is because JAXP is designed to allow different parsers and their factory classes to be plugged in. Both DOM and SAX parsers are developed independently of the Java JDK so it is important to be able to integrate new parsers as they come along. The Xerces parser that is currently distributed with the JDK is controlled and developed by the Apache Project, and it provides a very comprehensive range of capabilities. However, you may want to take advantage of the features provided by other parsers from other organizations, and JAXP allows for that.
These abstract classes act as wrappers for the specific factory and parser objects that you need to use for a particular parser and insulate your code from a particular parser implementation. An instance of a factory object that can create an instance of a parser is created at run time, so your program can use a different parser without changing or even recompiling your code. ...