public class XMLReferenceResolver extends java.lang.Object implements Reusable
This class represents a resolver for XML cross references during the marshalling/unmarshalling process.
Instances of this class may only be shared by XMLObjectReader/
XMLObjectWriter running sequentially (for cross references
spawning multiple documents).
| Constructor and Description |
|---|
XMLReferenceResolver()
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
createReference(java.lang.Object obj,
XMLFormat.InputElement xml)
Creates a reference for the specified object (the identifier
being specified by the input XML element).
|
java.lang.Object |
readReference(XMLFormat.InputElement xml)
Reads the object referenced by the specified xml input element if any.
|
void |
reset()
Resets the internal state of this object to its default values.
|
void |
setIdentifierAttribute(java.lang.String name)
Sets the name of the identifier attribute (by default
"id"). |
void |
setIdentifierAttribute(java.lang.String localName,
java.lang.String uri)
Sets the local name and namespace URI of the identifier attribute.
|
void |
setReferenceAttribute(java.lang.String name)
Sets the name of the reference attribute (by default
"ref"). |
void |
setReferenceAttribute(java.lang.String localName,
java.lang.String uri)
Sets the local name and namespace URI of the identifier attribute.
|
boolean |
writeReference(java.lang.Object obj,
XMLFormat.OutputElement xml)
Writes a reference to the specified object into the specified XML
element.
|
public void setIdentifierAttribute(java.lang.String name)
"id").
If the name is null then the identifier attribute
is never read/written (which may prevent unmarshalling).name - the name of the attribute or null.public void setIdentifierAttribute(java.lang.String localName,
java.lang.String uri)
localName - the local name of the attribute or null.uri - the URI of the attribute or null if the attribute
has no namespace URI.public void setReferenceAttribute(java.lang.String name)
"ref").
If the name is null then the reference attribute
is never read/written (which may prevent unmarshalling).name - the name of the attribute or null.public void setReferenceAttribute(java.lang.String localName,
java.lang.String uri)
localName - the local name of the attribute or null.uri - the URI of the attribute or null if the attribute
has no namespace URI.public boolean writeReference(java.lang.Object obj,
XMLFormat.OutputElement xml)
throws XMLStreamException
obj - the object for which the reference is written.xml - the output XML element.true if a reference is written;
false if a new identifier is written.XMLStreamExceptionpublic java.lang.Object readReference(XMLFormat.InputElement xml) throws XMLStreamException
xml - the input XML element.null if the specified
XML input does not have a reference attribute.XMLStreamExceptionpublic void createReference(java.lang.Object obj,
XMLFormat.InputElement xml)
throws XMLStreamException
obj - the object being referenced.xml - the input XML element holding the reference identifier.XMLStreamExceptionCopyright © 2005 - 2007 Javolution.