public abstract class Content extends java.lang.Object implements java.io.Serializable, NamespaceAware
Parent
nodes.Comment
,
DocType
,
Element
,
EntityRef
,
Parent
,
ProcessingInstruction
,
Text
,
Serialized FormModifier and Type | Class and Description |
---|---|
static class |
Content.CType
An enumeration useful for identifying content types without
having to do
instanceof type conditionals. |
Modifier and Type | Field and Description |
---|---|
protected Content.CType |
ctype
The content type enumerate value for this Content
|
protected Parent |
parent
The parent
Parent of this Content. |
Modifier | Constructor and Description |
---|---|
protected |
Content(Content.CType type)
Create a new Content instance of a particular type.
|
Modifier and Type | Method and Description |
---|---|
Content |
clone()
Return a deep clone of this instance.
|
Content |
detach()
Detaches this child from its parent or does nothing if the child
has no parent.
|
boolean |
equals(java.lang.Object ob)
This tests for equality of this Content object to the supplied object.
|
Content.CType |
getCType()
All content has an enumerated type expressing the type of content.
|
Document |
getDocument()
Return this child's owning document or null if the branch containing
this child is currently not attached to a document.
|
java.util.List<Namespace> |
getNamespacesInherited()
Obtain a list of all namespaces that are in scope for this content, but
were not introduced by this content.
|
java.util.List<Namespace> |
getNamespacesInScope()
Obtain a list of all namespaces that are in scope for the current
content.
|
java.util.List<Namespace> |
getNamespacesIntroduced()
Obtain a list of all namespaces that are introduced to the XML tree by
this node.
|
Parent |
getParent()
Return this child's parent, or null if this child is currently
not attached.
|
Element |
getParentElement()
A convenience method that returns any parent element for this element,
or null if the element is unattached or is a root element.
|
abstract java.lang.String |
getValue()
Returns the XPath 1.0 string value of this child.
|
int |
hashCode()
This returns the hash code for this
Content item. |
protected Content |
setParent(Parent parent)
Sets the parent of this Content.
|
protected transient Parent parent
Parent
of this Content.
Note that the field is not serialized, thus deserialized Content
instances are 'detached'protected final Content.CType ctype
protected Content(Content.CType type)
type
- The Content.CType
of this Contentpublic final Content.CType getCType()
public Content detach()
This method can be overridden by particular Content subclasses to return
a specific type of Content (co-variant return type). All overriding
subclasses must call super.detach()
;
public Parent getParent()
Element
or a Document
.
This method can be overridden by particular Content subclasses to return
a specific type of Parent (co-variant return type). All overriding
subclasses must call super.getParent()
;
public final Element getParentElement()
protected Content setParent(Parent parent)
This method can be overridden by particular Content subclasses to return
a specific type of Content (co-variant return type). All overriding
subclasses must call super.setParent(Parent)
;
parent
- new parent elementpublic Document getDocument()
public abstract java.lang.String getValue()
public Content clone()
All JDOM core classes are Cloneable, and never throw CloneNotSupportedException. Additionally all Cloneable JDOM classes return the correct type of instance from this method and there is no need to cast the result (co-variant return value).
Subclasses of this should still call super.clone() in their clone method.
public final boolean equals(java.lang.Object ob)
equals
in class java.lang.Object
ob
- Object
to compare to.boolean
- whether the Content
is
equal to the supplied Object
.public final int hashCode()
Content
item.hashCode
in class java.lang.Object
int
- hash code.public java.util.List<Namespace> getNamespacesInScope()
NamespaceAware
The contents of this list will always be the combination of getNamespacesIntroduced() and getNamespacesInherited().
See NamespaceAware
documentation for details on what the order of the
Namespaces will be in the returned list.
getNamespacesInScope
in interface NamespaceAware
public java.util.List<Namespace> getNamespacesIntroduced()
NamespaceAware
The contents of this list will always be a subset (but in the same order) of getNamespacesInScope(), and will never intersect getNamspacesInherited()
getNamespacesIntroduced
in interface NamespaceAware
public java.util.List<Namespace> getNamespacesInherited()
NamespaceAware
The contents of this list will always be a subset (but in the same order) of getNamespacesInScope(), and will never intersect getNamspacesIntroduced()
getNamespacesInherited
in interface NamespaceAware
Copyright © 2021 Jason Hunter, Brett McLaughlin. All Rights Reserved.