public abstract class AbstractItem extends Object implements Item, Node, Serializable, Cloneable
Important methods that the deriving might want to override.
Item,
Serialized FormFIND_BY_PREFIX, FIND_BY_REGEX, FIND_BY_TAGNAME, FIND_IGNORE_CASE, FIND_RECURSIVEATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE| Modifier | Constructor and Description |
|---|---|
protected |
AbstractItem()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Node |
appendChild(Node newChild) |
Object |
clone()
Clones this object (a deep cloning not including contents contained
in Textual nodes).
|
Node |
cloneNode(boolean deep) |
short |
compareDocumentPosition(Node other) |
Item |
detach()
Detach this item from its parent.
|
boolean |
equals(Object o)
Overriding this method is prohibited.
|
NamedNodeMap |
getAttributes() |
String |
getBaseURI() |
NodeList |
getChildNodes() |
Document |
getDocument()
Gets the document that owns this item.
|
Object |
getFeature(String feature,
String version) |
Node |
getFirstChild() |
Node |
getLastChild() |
String |
getLocalName() |
Locator |
getLocator()
Gets the locator of this item.
|
String |
getNamespaceURI() |
Node |
getNextSibling() |
String |
getNodeName() |
String |
getNodeValue() |
Document |
getOwnerDocument() |
Group |
getParent()
Gets the parent item.
|
Node |
getParentNode() |
String |
getPrefix() |
Node |
getPreviousSibling() |
String |
getText()
|
String |
getTextContent() |
Object |
getUserData(String key) |
boolean |
hasAttributes() |
boolean |
hasChildNodes() |
int |
hashCode()
Overriding this method is prohibited.
|
Node |
insertBefore(Node newChild,
Node refChild) |
boolean |
isDefaultNamespace(String namespaceURI) |
boolean |
isEqualNode(Node arg) |
boolean |
isSameNode(Node other) |
boolean |
isSupported(String feature,
String version) |
String |
lookupNamespaceURI(String prefix) |
String |
lookupPrefix(String namespaceURI) |
protected static boolean |
match(Namespaceable vtx,
String namespace,
String name,
Pattern ptn,
int mode)
Tests whether a namespaceable item matches the criteria.
|
void |
normalize() |
Node |
removeChild(Node oldChild) |
Node |
replaceChild(Node newChild,
Node oldChild) |
void |
setLocator(Locator loc)
Sets the locator of this item.
|
void |
setName(String name)
Sets the name of the item.
|
void |
setNodeValue(String nodeValue) |
void |
setParent(Group parent)
Sets the parent item.
|
void |
setPrefix(String prefix) |
void |
setText(String text)
Sets the text of this item.
|
void |
setTextContent(String textContent) |
Object |
setUserData(String key,
Object data,
UserDataHandler handler) |
finalize, getClass, notify, notifyAll, toString, wait, wait, waitgetNodeTypeprotected static boolean match(Namespaceable vtx, String namespace, String name, Pattern ptn, int mode)
public void setName(String name)
ItemsetName in interface ItemNamespaceable.setTagName(java.lang.String)public String getText()
ItemTextual
nor Element.
For Element, the text is the concatenation of all its textual
children, including Text, CDATA, and Binary.
Besides String-type value, some item, e.g., Binary, allows any type of objects. Caller could test whether a item implements the Binable interface, and use Binable.getValue instead. For binable vertices, getText is actually getValue().toString().
The returned value is neither trimmed nor normalized.
public void setText(String text)
Itempublic Document getDocument()
ItemgetDocument in interface Itempublic Item detach()
ItemBecause each item can belong to at most one parent at a time, it is important to detach it first, before added to another tree -- even if it is the same tree/parent.
It has the similar effect as:
getParent().getChildren().remove(this).
Naming reason: we don't call this method as getChildren() to be compatible with the naming style of Attributable.attributes -- which is limited to org.w3c.dom.Attr.getAttributes. Also, it doesn't have the setter and it is "live", so it 'seem' better to call it getChildren().
public final Group getParent()
Itempublic void setParent(Group parent)
ItemDO NOT call this method. It is used internally. Instead, use detach or thru getChildren().
public final Locator getLocator()
ItemgetLocator in interface Itempublic final void setLocator(Locator loc)
ItemUnlike other methods, it won't change the modification flag.
setLocator in interface Itemloc - the locator; null if not availablepublic String getNodeName()
getNodeName in interface Nodepublic String getNodeValue()
getNodeValue in interface Nodepublic void setNodeValue(String nodeValue)
setNodeValue in interface Nodepublic Document getOwnerDocument()
getOwnerDocument in interface Nodepublic final Node getParentNode()
getParentNode in interface Nodepublic final Node getPreviousSibling()
getPreviousSibling in interface Nodepublic final Node getNextSibling()
getNextSibling in interface Nodepublic NodeList getChildNodes()
getChildNodes in interface Nodepublic Node getFirstChild()
getFirstChild in interface Nodepublic Node getLastChild()
getLastChild in interface Nodepublic boolean hasChildNodes()
hasChildNodes in interface Nodepublic Node insertBefore(Node newChild, Node refChild)
insertBefore in interface Nodepublic Node replaceChild(Node newChild, Node oldChild)
replaceChild in interface Nodepublic Node removeChild(Node oldChild)
removeChild in interface Nodepublic Node appendChild(Node newChild)
appendChild in interface Nodepublic final boolean isSupported(String feature, String version)
isSupported in interface Nodepublic String getNamespaceURI()
getNamespaceURI in interface Nodepublic String getLocalName()
getLocalName in interface Nodepublic NamedNodeMap getAttributes()
getAttributes in interface Nodepublic boolean hasAttributes()
hasAttributes in interface Nodepublic String getBaseURI()
getBaseURI in interface Nodepublic short compareDocumentPosition(Node other) throws DOMException
compareDocumentPosition in interface NodeDOMExceptionpublic String getTextContent() throws DOMException
getTextContent in interface NodeDOMExceptionpublic void setTextContent(String textContent) throws DOMException
setTextContent in interface NodeDOMExceptionpublic boolean isSameNode(Node other)
isSameNode in interface Nodepublic String lookupPrefix(String namespaceURI)
lookupPrefix in interface Nodepublic boolean isDefaultNamespace(String namespaceURI)
isDefaultNamespace in interface Nodepublic String lookupNamespaceURI(String prefix)
lookupNamespaceURI in interface Nodepublic boolean isEqualNode(Node arg)
isEqualNode in interface Nodepublic Object getFeature(String feature, String version)
getFeature in interface Nodepublic Object setUserData(String key, Object data, UserDataHandler handler)
setUserData in interface Nodepublic Object getUserData(String key)
getUserData in interface Nodepublic final boolean equals(Object o)
public final int hashCode()
Copyright © 2018. All rights reserved.