CaiNiaoCoder
CaiNiaoCoder

Reputation: 3319

XML related api in JDK

I find there are a lot of packages in jdk 6 are xml related. such as:

as a java newbie, I want to know, how these xml related api orgnized? what can they do in xml related programing? please also mention the third part library those can do samilary job.

I used to use dom4j to do xml to object transform, and now I find we can using jaxb, which is built in jdk.

Upvotes: 1

Views: 400

Answers (2)

bdoughan
bdoughan

Reputation: 148977

There are several APIs in the JDK

  • javax.xml.parers - APIs for DOM/SAX parsing
    • org.w3c.dom - DOM related classes
    • org.xml.sax - SAX related classes
  • javax.xml.stream - APIs for StAX (pull) parsing
  • java.xml.bind - APIs for converting domain objects to/from XML.
  • javax.xml.transform - Transforming one XML document to another using a XSLT stylesheet.
  • javax.xml.validation - APIs for performing Schema validation
  • javax.xml.xpath - APIs for querying an XML document.

Using these APIs together

These APIs can be used together in many different ways (below are examples from my blog):

Note:

The com.sun.org.apache APIs are from the implementations of the standard XML APIs included in the JDK, I would recommend not using them directly. There are also alternate implementations of these standard APIs that can also be used that offer extensions beyond their corresponding specifications.

Upvotes: 4

Alexey Kutuzov
Alexey Kutuzov

Reputation: 689

Maybe you need JAXB: JAXB example. For me, Jaxb covers all needs in java.

Upvotes: 1

Related Questions