Package org.eclipse.persistence.oxm
Class XMLBinder
java.lang.Object
org.eclipse.persistence.oxm.XMLBinder
PUBLIC:
Purpose:Provide a runtime public interface for preserving unmapped content from an XML Document.
Responsibilities:
- Unmarshal XML into JavaObjects and maintain the associations between nodes and objects
- Update the cached XML based on changes to the object
- Update the cached objects based on changes to the XML Document
- Provide API to access the cached Node for a given object
- Provide API to access the cached Object for a given XML Node
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.
- See Also:
- Author:
- mmacivor
-
Constructor Summary
ConstructorDescriptionXMLBinder
(XMLContext context) XMLBinder
(XMLContext context, XMLMarshaller marshaller, XMLUnmarshaller unmarshaller) -
Method Summary
Modifier and TypeMethodDescriptionGets this XMLBinder's document preservation policy.Gets the Java Object associated with the provided XML Node.getXMLNode
(Object object) Gets the XML Node associated with the provided object.void
void
setErrorHandler
(ErrorHandler errorHandler) void
setMarshaller
(XMLMarshaller marshaller) void
This method will unmarshal the provided node into mapped java objects.void
updateObject
(Node node) Updates the object associated with the provided node to reflect any changed made to that node.void
This method will update the cached XML node for the provided object.void
-
Constructor Details
-
XMLBinder
-
XMLBinder
-
-
Method Details
-
unmarshal
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.
-
unmarshal
-
updateXML
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
-
updateXML
-
getXMLNode
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
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
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
Gets this XMLBinder's document preservation policy.- Returns:
- an instance of DocumentPreservationPolicy
- See Also:
-
getMarshaller
-
setMarshaller
-
setSchema
-
getSchema
-
setErrorHandler
-
getErrorHandler
-