What is Java API for XML (JAXP)
JAXP is the Java reference implementation for parsing, transforming, validating and querying XML documents. In other words using the JAXP API you can
- Parse an XML document using the Document Object Model (DOM) representation of the XML document – JAXP provides the classes that form the DOM Model.
- Parse an XML document as a series of events using Simple API for XML (SAX).
- Parse an XML document using a Streaming API for XML (StAX) or a ‘pull parser’ API
- Validate an XML document using a DTD or an external XSD
- Transform an XML Document using XSLT
- Query an XML document using an XPath API
JAXP provides the interfaces for the XML representation and parsing and delegates the actual parsing to a parser. It provides a mechanism by which any external parser can be plugged in. JAXP provides a default implementation of all three parsers but developers are free to add a custom parser. In the subsequent tutorials we will look at each of the parsing APIs in detail. We will also look at how the XML can be validated. The last tutorial in the series will explain a powerful way to query XML documents. i.e. the XPath API.