Javax.xml.bind.JAXB Class


Advertisements


Introduction

The javax.xml.bind.JAXB class defines convenience methods for common, simple use of JAXB.Following are the important points about JAXB −

  • This class consists of marshal and unmarshal methods.

  • All the methods on this class require non-null arguments to all parameters.

Class declaration

Following is the declaration for javax.xml.bind.JAXB class −

public final class JAXB
   extends Object

Class methods

S.N. Method & Description
1 static void marshal(Object jaxbObject, File xml)

This method writes a Java object tree to XML and store it to the specified location.

2 static void marshal(Object jaxbObject, OutputStream xml)

This method writes a Java object tree to XML and store it to the specified location.

3 static void marshal(Object jaxbObject, Result xml)

This method writes a Java object tree to XML and store it to the specified location.

4 static void marshal(Object jaxbObject, String xml)

This method writes a Java object tree to XML and store it to the specified location.

5 static void marshal(Object jaxbObject, URI xml)

This method writes a Java object tree to XML and store it to the specified location.

6 static void marshal(Object jaxbObject, URL xml)

This method writes a Java object tree to XML and store it to the specified location.

7 static void marshal(Object jaxbObject, Writer xml)

This method writes a Java object tree to XML and store it to the specified location.

8 static <T> T unmarshal(File xml, Class<T> type)

This method reads in a Java object tree from the given XML input.

9 static <T> T unmarshal(InputStream xml, Class<T> type)

This method reads in a Java object tree from the given XML input.

10 static <T> T unmarshal(Reader xml, Class<T> type)

This method reads in a Java object tree from the given XML input.

11 static <T> T unmarshal(Source xml, Class<T> type)

This method reads in a Java object tree from the given XML input.

12 static <T> T unmarshal(String xml, Class<T> type)

This method reads in a Java object tree from the given XML input.

13 static <T> T unmarshal(URI xml, Class<T> type)

This method reads in a Java object tree from the given XML input.

14 static <T> T unmarshal(URL xml, Class<T> type)

This method reads in a Java object tree from the given XML input.

Methods inherited

This class inherits methods from the following classes −

javax.xml.Object



Advertisements