public class XMLReferenceResolver extends Object
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(Object obj,
XMLFormat.InputElement xml)
Creates a reference for the specified object (the identifier
being specified by the input XML element).
|
Object |
readReference(XMLFormat.InputElement xml)
Reads the object referenced by the specified xml input element if any.
|
void |
reset() |
void |
setIdentifierAttribute(String name)
Sets the name of the identifier attribute (by default
"id" ). |
void |
setIdentifierAttribute(String localName,
String uri)
Sets the local name and namespace URI of the identifier attribute.
|
void |
setReferenceAttribute(String name)
Sets the name of the reference attribute (by default
"ref" ). |
void |
setReferenceAttribute(String localName,
String uri)
Sets the local name and namespace URI of the identifier attribute.
|
boolean |
writeReference(Object obj,
XMLFormat.OutputElement xml)
Writes a reference to the specified object into the specified XML
element.
|
public void setIdentifierAttribute(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(String localName, 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(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(String localName, 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(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.XMLStreamException
public Object readReference(XMLFormat.InputElement xml) throws XMLStreamException
xml
- the input XML element.null
if the specified
XML input does not have a reference attribute.XMLStreamException
public void createReference(Object obj, XMLFormat.InputElement xml) throws XMLStreamException
obj
- the object being referenced.xml
- the input XML element holding the reference identifier.XMLStreamException
public void reset()
Copyright © 2005-2013 Javolution. All Rights Reserved.