Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle TopLink
11g Release 1 (11.1.1)

E28847-01


org.eclipse.persistence.oxm
Class XMLBinder

java.lang.Object
  extended by org.eclipse.persistence.oxm.XMLBinder


public class XMLBinder
extends java.lang.Object

PUBLIC:

Purpose:Provide a runtime public interface for preserving unmapped content from an XML Document.

Responsibilities:

The XML Binder is a runtime class that allows an association to be maintained between the original XML Document and the Java Objects built from the Document. It allows unmapped content (such as comments, processing instructions or other unmapped elements and attributes) to be preserved. The XMLBinder is created through an XMLContext.

Author:
mmacivor
See Also:
XMLContext

Field Summary
(package private)  XMLContext context
           
(package private)  DocumentPreservationPolicy documentPreservationPolicy
           
(package private)  XMLMarshaller marshaller
           
(package private)  org.eclipse.persistence.internal.oxm.record.DOMReader reader
           
(package private)  org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller saxUnmarshaller
           
(package private)  XMLUnmarshaller unmarshaller
           

 

Constructor Summary
XMLBinder(XMLContext context)
           

 

Method Summary
private  XMLRoot buildXMLRootFromObject(java.lang.Object obj)
          Create an XMLRoot instance.
 DocumentPreservationPolicy getDocumentPreservationPolicy()
          Gets this XMLBinder's document preservation policy.
 org.xml.sax.ErrorHandler getErrorHandler()
           
 XMLMarshaller getMarshaller()
           
 java.lang.Object getObject(org.w3c.dom.Node node)
          Gets the Java Object associated with the provided XML Node.
 javax.xml.validation.Schema getSchema()
           
 org.w3c.dom.Node getXMLNode(java.lang.Object object)
          Gets the XML Node associated with the provided object.
 void marshal(java.lang.Object obj, org.w3c.dom.Node node)
           
 void setErrorHandler(org.xml.sax.ErrorHandler errorHandler)
           
 void setMarshaller(XMLMarshaller marshaller)
           
 void setSchema(javax.xml.validation.Schema aSchema)
           
 java.lang.Object unmarshal(org.w3c.dom.Node node)
          This method will unmarshal the provided node into mapped java objects.
 XMLRoot unmarshal(org.w3c.dom.Node node, java.lang.Class javaClass)
           
 void updateObject(org.w3c.dom.Node node)
          Updates the object associated with the provided node to reflect any changed made to that node.
 void updateXML(java.lang.Object obj)
          This method will update the cached XML node for the provided object.
 void updateXML(java.lang.Object obj, org.w3c.dom.Node associatedNode)
           
private  void validateNode(org.w3c.dom.Node node)
           

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

saxUnmarshaller

org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller saxUnmarshaller

context

XMLContext context

marshaller

XMLMarshaller marshaller

unmarshaller

XMLUnmarshaller unmarshaller

documentPreservationPolicy

DocumentPreservationPolicy documentPreservationPolicy

reader

org.eclipse.persistence.internal.oxm.record.DOMReader reader

Constructor Detail

XMLBinder

public XMLBinder(XMLContext context)

Method Detail

unmarshal

public java.lang.Object unmarshal(org.w3c.dom.Node node)
This method will unmarshal the provided node into mapped java objects. The original node will be cached rather than thrown away.
Parameters:
node -
Returns:
The root object unmarshalled from the provided node.

validateNode

private void validateNode(org.w3c.dom.Node node)

unmarshal

public XMLRoot unmarshal(org.w3c.dom.Node node,
                         java.lang.Class javaClass)

updateXML

public void updateXML(java.lang.Object obj)
This method will update the cached XML node for the provided object. If no node exists for this object, then no operation is performed.
Parameters:
obj -

marshal

public void marshal(java.lang.Object obj,
                    org.w3c.dom.Node node)

updateXML

public void updateXML(java.lang.Object obj,
                      org.w3c.dom.Node associatedNode)

getXMLNode

public org.w3c.dom.Node getXMLNode(java.lang.Object object)
Gets the XML Node associated with the provided object.
Parameters:
object -
Returns:
an XML Node used to construct the given object. Null if no node exists for this object.

getObject

public java.lang.Object getObject(org.w3c.dom.Node node)
Gets the Java Object associated with the provided XML Node.
Parameters:
node -
Returns:
the Java Object associated with this node. If no object is associated then returns null

updateObject

public void updateObject(org.w3c.dom.Node node)
Updates the object associated with the provided node to reflect any changed made to that node. If this Binder has no object associated with the given node, then no operation is performed.
Parameters:
node -

getDocumentPreservationPolicy

public DocumentPreservationPolicy getDocumentPreservationPolicy()
Gets this XMLBinder's document preservation policy.
Returns:
an instance of DocumentPreservationPolicy
See Also:
DocumentPreservationPolicy

getMarshaller

public XMLMarshaller getMarshaller()

setMarshaller

public void setMarshaller(XMLMarshaller marshaller)

setSchema

public void setSchema(javax.xml.validation.Schema aSchema)

getSchema

public javax.xml.validation.Schema getSchema()

setErrorHandler

public void setErrorHandler(org.xml.sax.ErrorHandler errorHandler)

getErrorHandler

public org.xml.sax.ErrorHandler getErrorHandler()

buildXMLRootFromObject

private XMLRoot buildXMLRootFromObject(java.lang.Object obj)
Create an XMLRoot instance. If the object is an instance of XMLRoot it will simply be returned. Otherwise, we will create a new XMLRoot using the object's descriptor default root element - any prefixes will be resolved - and the given object
Parameters:
obj -
Returns:
an XMLRoot instance encapsulating the given object

Skip navigation links

Copyright © 1998, 2012, Oracle. All Rights Reserved.