Java vs. xml storyline: JAXB and Jaxp

Source: Internet
Author: User

When I first started using Java, I would sometimes consider using XML to store data, which would normally use the DOM in JAXP or the SAX parser package to crud XML files. Later, the Web service was very well formatted document, WSDL, XSD, which is very suitable for the automatic generation of code, so there is JAXB, through the annotation to facilitate the conversion between XML and Java class.

jaxp (Java API for XML processing) Dom ( document object Model " treats the whole XML as object processing, which is very convenient for random reading and writing. However, if the XML file is large, it may be problematic for memory consumption, SAX (simple API FOR XML ) treats all nodes in XML as event handlers (org.xml.sax.helpers.defaulthandler ", the sequential reading of the XML file is much better than DOM and consumes less memory faster.

JAXP also has a very useful 2 members, XSTL (extensible Stylesheet Language Transformations) in Java to implement XML and other formats of conversion and Stax (streaming API for XML) is similar to sax in that it handles XML files in a streaming fashion while actively pulling the data instead of passively waiting for the event to arrive.

JAXP's API can be said to be the direct processing of XML low-level API, for WebService and ORM Services, direct use is too complex, in order to further simplify the work of programmers, JAXB (Java Architecture for XML Binding ) appears as a special API (belonging to thejavax.xml.bind的一部分) ,using the XML document'sXML SchemaDefinition (XSD), in JavaUse annotations to implement XML document and Java Object Model mapping.

In the next series, the main thing is to write how you can transform XML and Java objects through JAXB.

Java vs. xml storyline: JAXB and Jaxp

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.