Interface XMLObject
-
- All Known Subinterfaces:
AttributeExtensibleXMLObject,ElementExtensibleXMLObject,XSAny,XSBase64Binary,XSBoolean,XSDateTime,XSInteger,XSQName,XSString,XSURI
- All Known Implementing Classes:
AbstractElementExtensibleXMLObject,AbstractExtensibleXMLObject,AbstractXMLObject,XSAnyImpl,XSBase64BinaryImpl,XSBooleanImpl,XSDateTimeImpl,XSIntegerImpl,XSQNameImpl,XSStringImpl,XSURIImpl
public interface XMLObjectA object that represents an XML element, usually of a specific schema type, that has been unmarshalled into this Java object.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voiddetach()Detaches the XMLObject from its parent.ElementgetDOM()Gets the DOM representation of this XMLObject, if one exists.QNamegetElementQName()Gets the QName for this element.IDIndexgetIDIndex()Get the IDIndex holding the ID-to-XMLObject index mapping, rooted at this XMLObject's subtree.NamespaceManagergetNamespaceManager()Gets theNamespaceManagerinstance for this object.Set<Namespace>getNamespaces()Gets the namespaces that are scoped to this element.StringgetNoNamespaceSchemaLocation()Gets the value of the XML Schema noNamespaceSchemaLocation attribute for this object.LockableClassToInstanceMultiMap<Object>getObjectMetadata()Get the mutable multimap which holds additional information (represented by plain Java object instances) associated with this XMLObject.List<XMLObject>getOrderedChildren()Gets an unmodifiable list of child elements in the order that they will appear in the DOM.XMLObjectgetParent()Gets the parent of this element or null if there is no parent.StringgetSchemaLocation()Gets the value of the XML Schema schemaLocation attribute for this object.QNamegetSchemaType()Gets the XML schema type of this element.booleanhasChildren()Checks if this XMLObject has children.booleanhasParent()Checks to see if this object has a parent.BooleanisNil()Gets whether the object declares that its element content is null, which corresponds to anxsi:nilattribute oftrue.XSBooleanValueisNilXSBoolean()Gets whether the object declares that its element content is null, which corresponds to anxsi:nilattribute oftrue.voidreleaseChildrenDOM(boolean propagateRelease)Releases the DOM representation of this XMLObject's children.voidreleaseDOM()Releases the DOM representation of this XMLObject, if there is one.voidreleaseParentDOM(boolean propagateRelease)Releases the DOM representation of this XMLObject's parent.XMLObjectresolveID(String id)Find the XMLObject identified by the specified ID attribute, within the subtree of XMLObjects which has this XMLObject as its root.XMLObjectresolveIDFromRoot(String id)Find the XMLObject identified by the specified ID attribute, from the root of the tree of XMLObjects in which this XMLObject is a member.voidsetDOM(Element dom)Sets the DOM representation of this XMLObject.voidsetNil(Boolean newNil)Sets whether the object declares that its element content is null, which corresponds to anxsi:nilattribute oftrue.voidsetNil(XSBooleanValue newNil)Sets whether the object declares that its element content is null, which corresponds to anxsi:nilattribute oftrue.voidsetNoNamespaceSchemaLocation(String location)Sets the value of the XML Schema noNamespaceSchemaLocation attribute for this object.voidsetParent(XMLObject parent)Sets the parent of this element.voidsetSchemaLocation(String location)Sets the value of the XML Schema schemaLocation attribute for this object.
-
-
-
Method Detail
-
detach
void detach()
Detaches the XMLObject from its parent. This will release the parent's cached DOM (if it has one) and set this object's parent to null. It does not remove this object from its parent, that's the responsibility of the invoker of this method, nor does it re-root the cached DOM node (if there is one) in a new document. This is handled at marshalling time.
-
getDOM
@Nullable Element getDOM()
Gets the DOM representation of this XMLObject, if one exists.- Returns:
- the DOM representation of this XMLObject, or null
-
getElementQName
@Nonnull QName getElementQName()
Gets the QName for this element. This QName MUST contain the namespace URI, namespace prefix, and local element name.- Returns:
- the QName for this attribute
-
getIDIndex
@Nonnull IDIndex getIDIndex()
Get the IDIndex holding the ID-to-XMLObject index mapping, rooted at this XMLObject's subtree.- Returns:
- the IDIndex owned by this XMLObject
-
getNamespaceManager
@Nonnull NamespaceManager getNamespaceManager()
Gets theNamespaceManagerinstance for this object.- Returns:
- the namespace manager for this object
-
getNamespaces
@Nonnull Set<Namespace> getNamespaces()
Gets the namespaces that are scoped to this element.- Returns:
- the namespaces that are scoped to this element
-
getNoNamespaceSchemaLocation
@Nullable String getNoNamespaceSchemaLocation()
Gets the value of the XML Schema noNamespaceSchemaLocation attribute for this object.- Returns:
- value of the XML Schema noNamespaceSchemaLocation attribute for this object
-
getOrderedChildren
@Nullable List<XMLObject> getOrderedChildren()
Gets an unmodifiable list of child elements in the order that they will appear in the DOM.- Returns:
- ordered list of child elements
-
getParent
@Nullable XMLObject getParent()
Gets the parent of this element or null if there is no parent.- Returns:
- the parent of this element or null
-
getSchemaLocation
@Nullable String getSchemaLocation()
Gets the value of the XML Schema schemaLocation attribute for this object.- Returns:
- schema location defined for this object
-
getSchemaType
@Nullable QName getSchemaType()
Gets the XML schema type of this element. This translates to the contents of the xsi:type attribute.- Returns:
- XML schema type of this element, or null
-
hasChildren
boolean hasChildren()
Checks if this XMLObject has children.- Returns:
- true if this XMLObject has children, false if not
-
hasParent
boolean hasParent()
Checks to see if this object has a parent.- Returns:
- true if the object has a parent, false if not
-
releaseChildrenDOM
void releaseChildrenDOM(boolean propagateRelease)
Releases the DOM representation of this XMLObject's children.- Parameters:
propagateRelease- true if all descendants of this element should release their DOM
-
releaseDOM
void releaseDOM()
Releases the DOM representation of this XMLObject, if there is one.
-
releaseParentDOM
void releaseParentDOM(boolean propagateRelease)
Releases the DOM representation of this XMLObject's parent.- Parameters:
propagateRelease- true if all ancestors of this element should release their DOM
-
resolveID
@Nullable XMLObject resolveID(@Nonnull String id)
Find the XMLObject identified by the specified ID attribute, within the subtree of XMLObjects which has this XMLObject as its root.- Parameters:
id- the ID attribute to resolve to an XMLObject- Returns:
- the XMLObject identified by the specified ID attribute value, or null
-
resolveIDFromRoot
@Nullable XMLObject resolveIDFromRoot(@Nonnull String id)
Find the XMLObject identified by the specified ID attribute, from the root of the tree of XMLObjects in which this XMLObject is a member.- Parameters:
id- the ID attribute to resolve to an XMLObject- Returns:
- the XMLObject identified by the specified ID attribute value, or null
-
setDOM
void setDOM(@Nullable Element dom)Sets the DOM representation of this XMLObject.- Parameters:
dom- DOM representation of this XMLObject
-
setNoNamespaceSchemaLocation
void setNoNamespaceSchemaLocation(@Nullable String location)Sets the value of the XML Schema noNamespaceSchemaLocation attribute for this object.- Parameters:
location- value of the XML Schema noNamespaceSchemaLocation attribute for this object
-
setParent
void setParent(@Nullable XMLObject parent)Sets the parent of this element.- Parameters:
parent- the parent of this element
-
setSchemaLocation
void setSchemaLocation(@Nullable String location)Sets the value of the XML Schema schemaLocation attribute for this object.- Parameters:
location- value of the XML Schema schemaLocation attribute for this object
-
isNil
@Nullable Boolean isNil()
Gets whether the object declares that its element content is null, which corresponds to anxsi:nilattribute oftrue.Note that it is up to the developer to ensure that the value of this attribute is consistent with the actual element content on the object instance.
Per the XML Schema specification, a value of true disallows element content, but not element attributes.
- Returns:
- whether the object's content model is null
- See Also:
- XML Schema: Nil Values
-
isNilXSBoolean
@Nullable XSBooleanValue isNilXSBoolean()
Gets whether the object declares that its element content is null, which corresponds to anxsi:nilattribute oftrue.Note that it is up to the developer to ensure that the value of this attribute is consistent with the actual element content on the object instance.
Per the XML Schema specification, a value of true disallows element content, but not element attributes.
- Returns:
- whether the object's content model is null
- See Also:
- XML Schema: Nil Values
-
setNil
void setNil(@Nullable Boolean newNil)Sets whether the object declares that its element content is null, which corresponds to anxsi:nilattribute oftrue.Note that it is up to the developer to ensure that the value of this attribute is consistent with the actual element content on the object instance.
Per the XML Schema specification, a value of true disallows element content, but not element attributes.
- Parameters:
newNil- whether the object's content model is expressed as null- See Also:
- XML Schema: Nil Values
-
setNil
void setNil(@Nullable XSBooleanValue newNil)Sets whether the object declares that its element content is null, which corresponds to anxsi:nilattribute oftrue.Note that it is up to the developer to ensure that the value of this attribute is consistent with the actual element content on the object instance.
Per the XML Schema specification, a value of true disallows element content, but not element attributes.
- Parameters:
newNil- whether the object's content model is expressed as null- See Also:
- XML Schema: Nil Values
-
getObjectMetadata
@Nonnull LockableClassToInstanceMultiMap<Object> getObjectMetadata()
Get the mutable multimap which holds additional information (represented by plain Java object instances) associated with this XMLObject.Objects added to this multimap will be indexed and retrievable by their concrete
Classas well as by theClasstypes representing all superclasses (excludingjava.lang.Object) and all implemented interfaces.- Returns:
- the class-to-instance multimap
-
-