Javax.xml.bind.Binder Class



Introduction

The javax.xml.bind.Binder class enable synchronization between XML infoset nodes and JAXB objects representing same XML document.Following are the important points about Binder −

  • An instance of this class maintains the association between XML nodes of an infoset preserving view and a JAXB representation of an XML document.

  • As bytes from the stream are read or skipped, the internal buffer is refilled as necessary from the contained input stream, many bytes at a time.

Class declaration

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

public abstract class Binder<XmlNode>
   extends Object

Class constructors

S.N. Constructor & Description
1 Binder()

Single Constructor.

Class methods

S.N. Method & Description
1 abstract ValidationEventHandler getEventHandler()

This method returns the current event handler or the default event handler if one hasn't been set.

2 abstract Object getJAXBNode(XmlNode xmlNode)

This method gets the JAXB object associated with the given XML element.

3 abstract Object getProperty(String name)

This method get the particular property in the underlying implementation of Binder.

4 abstract Schema getSchema()

This method gets the last Schema object (including null) set by the setSchema(Schema) method.

5 abstract XmlNode getXMLNode(Object jaxbObject)

This method Gets the XML element associated with the given JAXB object.

6 abstract void marshal(Object jaxbObject, XmlNode xmlNode)

This method marshal a JAXB object tree to a new XML document.

7 abstract void setEventHandler(ValidationEventHandler handler)

This method allow an application to register a ValidationEventHandler.

8 abstract void setProperty(String name, Object value)

This method set the particular property in the underlying implementation of Binder.

9 abstract void setSchema(Schema schema)

This method specifies whether marshal, unmarshal and update methods performs validation on their XML content.

10 abstract Object unmarshal(XmlNode xmlNode)

This method Unmarshal XML infoset view to a JAXB object tree.

11 abstract <T> JAXBElement<T> unmarshal(XmlNode xmlNode, Class<T> declaredType)

This method Unmarshal XML root element by provided declaredType to a JAXB object tree.

12 abstract Object updateJAXB(XmlNode xmlNode)

This method takes an XML node and updates its associated JAXB object and its descendants.

13 abstract XmlNode updateXML(Object jaxbObject)

This method takes an JAXB object and updates its associated XML node and its descendants.

14 abstract XmlNode updateXML(Object jaxbObject, XmlNode xmlNode)

This method changes in JAXB object tree are updated in its associated XML parse tree.

Methods inherited

This class inherits methods from the following classes −

javax.xml.Object



Advertisements