---
title: Java API for XML Processing
slug: java-api-for-xml-processing
qid: 
snapshot: enwiki-001355635041
content_hash: 
license: CC BY-SA 4.0
source: https://en.wikipedia.org/w/index.php?oldid=1355635041
tags: [22991692, 23117742, 23535758, 23603337, 24623845, 24745114, 26157654, 26220375, 26748027, 31682881, 32931270, 50918331]
---

# Java API for XML Processing

> [!note] Provenance
> Snapshot `enwiki-001355635041` · content root `…`
> Derived from <https://en.wikipedia.org/w/index.php?oldid=1355635041> · Licensed CC BY-SA 4.0

In computing, the Java API for XML Processing (JAXP) ( ), one of the Java XML application programming interfaces (APIs), provides the capability of validating and parsing XML documents. It has three basic parsing interfaces: * the Document Object Model parsing interface or DOM interface * the Simple API for XML parsing interface or SAX interface * the Streaming API for XML or StAX interface (part of JDK 6; separate jar available for JDK 5) In addition to the parsing interfaces, the API provides an XSLT interface to provide data and structural transformations on an XML document. JAXP was developed under the Java Community Process as JSR 5 (JAXP 1.0), JSR 63 (JAXP 1.1 and 1.2), and JSR 206 (JAXP 1.3). JAXP version 1.4.4 was released on September 3, 2010. JAXP 1.3 was declared end-of-life on February 12, 2008.

In computing, the Java API for XML Processing (JAXP) ( ), one of the Java XML application programming interfaces (APIs), provides the capability of validating and parsing XML documents. It has three basic parsing interfaces: the Document Object Model parsing interface or DOM interface the Simple API for XML parsing interface or SAX interface the Streaming API for XML or StAX interface (part of JDK 6; separate jar available for JDK 5) In addition to the parsing interfaces, the API provides an XSLT interface to provide data and structural transformations on an XML document. JAXP was developed under the Java Community Process as JSR 5 (JAXP 1.0), JSR 63 (JAXP 1.1 and 1.2), and JSR 206 (JAXP 1.3). JAXP version 1.4.4 was released on September 3, 2010. JAXP 1.3 was declared end-of-life on February 12, 2008. The most primitive but complete example of XSLT transformation launching may look like this: /* file src/examples/xslt/XsltDemo.java */ package examples.xslt; import java.io.StringReader; import java.io.StringWriter; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.TransformerFactoryConfigurationError; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; public class XsltDemo { public static void main(String[] args) throws TransformerFactoryConfigurationError, TransformerException { //language=xslt String xsltResource = """ world """; // language=XML String xmlSourceResource = """ """; StringWriter xmlResultResource = new StringWriter(); Transformer xmlTransformer = TransformerFactory.newInstance().newTransformer( new StreamSource(new StringReader(xsltResource)) ); xmlTransformer.transform( new StreamSource(new StringReader(xmlSourceResource)), new StreamResult(xmlResultResource) ); System.out.println(xmlResultResource.getBuffer().toString()); } } It applies the following hardcoded XSLT transformation: world To the following hardcoded XML document: The result of execution will be hello world
