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.
≈ 2 min read
Java API for XML Processing. encyclopegia.org, snapshot enwiki-001355635041. /a/java-api-for-xml-processing
Names in other languages
No names in other languages are held for this entry yet.
Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.
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
Text derived from https://en.wikipedia.org/w/index.php?oldid=1355635041 under CC BY-SA 4.0; modifications have been made.
References
1 claim could not be tied to a specific sentence and is listed in the table below instead.