Java for Xml:jaxp, JAXB, JAXM, Jax-RPC, JAX-ws

Source: Internet
Author: User
Tags soap xpath java se

In the XML domain, there are two ways to verify the XML file: DTD checksum, schema checksum. In Java, there are several ways to parse XML: DOM parsing, sax parsing, Stax parsing. When combined with XML and Java, bind technology is generated, transforming XML and Java beans into one another.

A brief introduction to the Java XML Processing technology (JAXP)

Jaxp,java API for XML processing. This includes parsing, validating, querying, and transforming XML.

1) parsing, parsing XML into corresponding memory objects, typically such as document in Dom parsing. The parsing techniques currently available in Java se are: DOM, SAX, STAX.

2) verification, Java SE currently supports DTD, schema validation.

3) query, here is the query refers to the use of XPath query. This section has a separate API. As for the DOM parsing, it is not used as the query technique, depending on the node's subordinate relationship. Because XPath is a query technique for XML that is defined by the consortium, XPath is for Dom parsing.

4) The transformation is to transform the contents of the XML document to the specified target, for example, after modifying the XML element with JAVAAPI (which is the modification of the memory object) and saving it to the specified location.

Three different processing methods are formed for three different analytic methods. But one thing can be the same, that is the process of transformation. These three kinds of processing methods, can use transform related API for memory object to file transformation.

1) DOM

DOM is the standard API for processing XML, which is the basis of many other standards related to XML processing, not only Java, but also other languages such as javascript,php,ms. NET and so on, which has become the most widely used XML processing method. Of course, in order to provide more powerful features, Java has a lot of direct DOM extension tools, such as many Java programmers familiar with the jdom,dom4j, and so on, they basically belong to the DOM interface function expansion, preserving a lot of Dom API features, many of the original do M programmers do not even have any obstacles to master the use of the other two, intuitive, easy-to-operate way to make it popular with the vast number of Java programmers.

using the DOM the processing flow of analytic mode:

1) Use the DOM parser to parse the XML file into document (which is a DOM tree)

2) Add and revise the document as needed

3) If necessary, generate a new XML file

When searching for the document node, XPath can be used depending on the DOM tree structure.

2) SAX

SAX supports XML processing with minimal system resources and the fastest parsing methods. However, the cumbersome way to find a large number of programmers to bring a lot of trouble, often headache, and its support for the XPath query function, so that people love and hate it.

using sax the processing flow of analytic mode:

1) Call various handler for processing when reading a document using the SAX parser.

2) When necessary, generate a new XML document

3) StAX

StAx, streaming API for XML

It is located in the Javax.xml.stream package. The Xmlstreamreader interface is used to parse an XML document, while the Xmlstreamwriter interface is used to generate an XML document. Xmleventreader is responsible for parsing XML events using an object event iteration-This contrasts with the cursor mechanism used by xmlstreamreader. This tutorial will perform an analysis of an XML document based on the Stax implementation in JDK 6.0.

Java Bean Binding to XML (JAXB)

JAXB is an API designed to convert a Java object into an XML file, or to convert an XML file into a Java object.

The bridge between them is the XML schema. To learn JAXB, you can refer to https://jaxb.java.net/tutorial/

SOAP Message (JAXM)

Under the Javax.xml.soap package. Used for messages in Jax-ws.

WebService (JAX-RPC \ jax-WS)

Api:jax-rpc Jax-ws for Web service.

Jax-RPC : https://java.net/projects/jax-rpc/

Jax-RPC (the Java application Interface for remote procedure calls based on Extensible Markup Language XML) is the application interface (API) of the Java Web Services Development package (WSDP), WSDP enables Java developers to include remote procedure calls in Web services or other Web applications (RPC). JAX-RPC is committed to making it easier for applications or Web services to invoke other applications or Web services.

JAX-RPC provides a programming model for the development of an application based on SOAP (Simple Object Access Protocol). The JAX-RPC programming model simplifies development by abstracting the operating mechanism of the SOAP protocol layer and providing a mapping service between Java and the Web Services Description Language (WSDL).

Jax-ws : https://jax-ws.java.net/

The JAX-WS specification is a set of Java API,JAX-WS for XML Web services that allows developers to choose rpc-oriented or message-oriented to implement their own web services.

In Jax-WS, a remote invocation can be converted to an XML-based protocol such as SOAP, where the developer does not need to write any code that generates and processes SOAP messages. The JAX-WS runtime implementation translates calls from these APIs into corresponding SOAP messages.

Java for Xml:jaxp, JAXB, JAXM, Jax-RPC, JAX-ws

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.