e01.org

Java API for XML Processing

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

References

  1. ^ "The Java Community Process(SM) Program - JSRS: Java Specification Requests - detail JSR# 206" . Wikipedia revision 1355635041, retrieved 2026-11-21 · 1795215600.0
  2. ^ Compare the Java 1.2.1 API index with the 1.3 index . The Java Specification Request (JSR) 5, XML Parsing Specification , was finalised on 21 March, 2000 . Wikipedia revision 1355635041, retrieved 2026-11-21 · 1795215600.0
  3. ^ Horstmann 2022 , §3.3 Parsing an XML Document. Wikipedia revision 1355635041, retrieved 2026-11-21 · 1795215600.0
source: e01 Encyclopedia · licence: CC BY-SA 4.0 · page · source revision

Cite this

"Java API for XML Processing". 1779489086. e01 Encyclopedia. CC BY-SA 4.0. https://en.wikipedia.org/w/index.php?oldid=1355635041

JSON record · API collection · citation policy