public class DomElement extends DomNamespaceNode implements Element, ElementTraversal
| Modifier and Type | Class and Description |
|---|---|
protected static class |
DomElement.ChildElementsIterator
An iterator over the DomElement children.
|
DomNode.ChildIterator, DomNode.DescendantElementsIterator<T extends DomNode>| Modifier and Type | Field and Description |
|---|---|
static String |
ATTRIBUTE_NOT_DEFINED
Constant meaning that the specified attribute was not defined.
|
static String |
ATTRIBUTE_VALUE_EMPTY
Constant meaning that the specified attribute was found but its value was empty.
|
AS_TEXT_BLANK, AS_TEXT_BLOCK_SEPARATOR, AS_TEXT_NEW_LINE, AS_TEXT_TAB, PROPERTY_ELEMENT, READY_STATE_COMPLETE, READY_STATE_INTERACTIVE, READY_STATE_LOADED, READY_STATE_LOADING, READY_STATE_UNINITIALIZEDATTRIBUTE_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| Constructor and Description |
|---|
DomElement(String namespaceURI,
String qualifiedName,
SgmlPage page,
Map<String,DomAttr> attributes)
Creates an instance of a DOM element that can have a namespace.
|
| Modifier and Type | Method and Description |
|---|---|
DomNode |
cloneNode(boolean deep) |
String |
getAttribute(String attributeName)
Returns the value of the attribute specified by name or an empty string.
|
DomAttr |
getAttributeNode(String name) |
DomAttr |
getAttributeNodeNS(String namespaceURI,
String localName) |
String |
getAttributeNS(String namespaceURI,
String localName)
Returns the value of the attribute specified by namespace and local name or an empty
string.
|
NamedNodeMap |
getAttributes() |
Map<String,DomAttr> |
getAttributesMap()
Returns the map holding the attributes, keyed by name.
|
int |
getChildElementCount() |
Iterable<DomElement> |
getChildElements() |
DomNodeList<HtmlElement> |
getElementsByTagName(String tagName) |
DomNodeList<HtmlElement> |
getElementsByTagNameNS(String namespace,
String localName)
Not yet implemented.
|
DomElement |
getFirstElementChild() |
String |
getId() |
DomElement |
getLastElementChild() |
DomElement |
getNextElementSibling() |
String |
getNodeName()
Returns this node's node name.
|
short |
getNodeType()
Returns this node's node type.
|
DomElement |
getPreviousElementSibling() |
TypeInfo |
getSchemaTypeInfo()
Not yet implemented.
|
String |
getTagName()
Returns the tag name of this element.
|
boolean |
hasAttribute(String attributeName)
Returns whether the attribute specified by name has a value.
|
boolean |
hasAttributeNS(String namespaceURI,
String localName)
Returns whether the attribute specified by namespace and local name has a value.
|
boolean |
hasAttributes() |
protected boolean |
isAttributeCaseSensitive()
Indicates if the attribute names are case sensitive.
|
protected boolean |
isEmptyXmlTagExpanded()
Indicates if a node without children should be written in expanded form as XML
(i.e.
|
protected Map<String,String> |
namespaces()
Returns namespaces.
|
protected void |
printOpeningTagContentAsXml(PrintWriter printWriter)
Prints the content between "<" and ">" (or "/>") in the output of the tag name
and its attributes in XML format.
|
protected void |
printXml(String indent,
PrintWriter printWriter)
Recursively write the XML data for the node tree starting at
node. |
void |
removeAttribute(String attributeName)
Removes an attribute specified by name from this element.
|
Attr |
removeAttributeNode(Attr attribute)
Not yet implemented.
|
void |
removeAttributeNS(String namespaceURI,
String localName)
Removes an attribute specified by namespace and local name from this element.
|
void |
setAttribute(String attributeName,
String attributeValue)
Sets the value of the attribute specified by name.
|
Attr |
setAttributeNode(Attr attribute) |
Attr |
setAttributeNodeNS(Attr attribute)
Not yet implemented.
|
void |
setAttributeNS(String namespaceURI,
String qualifiedName,
String attributeValue)
Sets the value of the attribute specified by namespace and qualified name.
|
void |
setIdAttribute(String name,
boolean isId)
Not yet implemented.
|
void |
setIdAttributeNode(Attr idAttr,
boolean isId)
Not yet implemented.
|
void |
setIdAttributeNS(String namespaceURI,
String localName,
boolean isId)
Not yet implemented.
|
getLocalName, getNamespaceURI, getPrefix, getQualifiedName, processImportNode, setPrefixaddDomChangeListener, appendChild, asText, asXml, checkChildHierarchy, compareDocumentPosition, detach, fireNodeAdded, fireNodeDeleted, getAncestors, getBaseURI, getByXPath, getByXPath, getCanonicalXPath, getChildNodes, getChildren, getDescendants, getEndColumnNumber, getEndLineNumber, getFeature, getFirstByXPath, getFirstByXPath, getFirstChild, getHtmlElementDescendants, getHtmlPageOrNull, getIndex, getLastChild, getNextSibling, getNodeValue, getOwnerDocument, getPage, getParentNode, getPreviousSibling, getReadyState, getScriptObject, getStartColumnNumber, getStartLineNumber, getTextContent, getUserData, hasChildNodes, hasFeature, insertBefore, insertBefore, isAncestorOf, isAncestorOfAny, isBlock, isDefaultNamespace, isDescendant, isDirectlyAttachedToPage, isDisplayed, isEqualNode, isSameNode, isSupported, isTrimmedText, lookupNamespaceURI, lookupPrefix, mayBeDisplayed, normalize, notifyIncorrectness, onAddedToDocumentFragment, onAddedToPage, onAllChildrenAddedToPage, printChildrenAsXml, querySelector, querySelectorAll, remove, removeAllChildren, removeChild, removeDomChangeListener, replace, replaceChild, setNextSibling, setNodeValue, setParentNode, setPreviousSibling, setReadyState, setScriptObject, setTextContent, setUserDataclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitappendChild, compareDocumentPosition, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserDatapublic static final String ATTRIBUTE_NOT_DEFINED
public static final String ATTRIBUTE_VALUE_EMPTY
public DomElement(String namespaceURI, String qualifiedName, SgmlPage page, Map<String,DomAttr> attributes)
namespaceURI - the URI that identifies an XML namespacequalifiedName - the qualified name of the element type to instantiatepage - the page that contains this elementattributes - a map ready initialized with the attributes for this element, or
null. The map will be stored as is, not copied.public String getNodeName()
getNodeName in interface NodegetNodeName in class DomNodepublic final short getNodeType()
getNodeType in interface NodegetNodeType in class DomNodepublic final String getTagName()
getTagName in interface Elementpublic final boolean hasAttributes()
hasAttributes in interface NodehasAttributes in class DomNodepublic boolean hasAttribute(String attributeName)
hasAttribute in interface ElementattributeName - the name of the attributeprotected void printOpeningTagContentAsXml(PrintWriter printWriter)
printWriter - the writer to print inprotected void printXml(String indent, PrintWriter printWriter)
node.protected boolean isEmptyXmlTagExpanded()
false by defaultpublic String getAttribute(String attributeName)
ATTRIBUTE_NOT_DEFINED
if the attribute wasn't specified or ATTRIBUTE_VALUE_EMPTY if the
attribute was specified but it was empty.getAttribute in interface ElementattributeName - the name of the attributeATTRIBUTE_NOT_DEFINED or ATTRIBUTE_VALUE_EMPTYpublic void removeAttribute(String attributeName)
removeAttribute in interface ElementattributeName - the attribute attributeNamepublic final void removeAttributeNS(String namespaceURI, String localName)
removeAttributeNS in interface ElementnamespaceURI - the URI that identifies an XML namespacelocalName - the name within the namespacepublic final Attr removeAttributeNode(Attr attribute)
removeAttributeNode in interface Elementpublic final boolean hasAttributeNS(String namespaceURI, String localName)
hasAttributeNS in interface ElementnamespaceURI - the URI that identifies an XML namespacelocalName - the name within the namespacepublic final Map<String,DomAttr> getAttributesMap()
public NamedNodeMap getAttributes()
getAttributes in interface NodegetAttributes in class DomNodepublic final void setAttribute(String attributeName, String attributeValue)
setAttribute in interface ElementattributeName - the name of the attributeattributeValue - the value of the attributepublic void setAttributeNS(String namespaceURI, String qualifiedName, String attributeValue)
setAttributeNS in interface ElementnamespaceURI - the URI that identifies an XML namespacequalifiedName - the qualified name (prefix:local) of the attributeattributeValue - the value of the attributeprotected boolean isAttributeCaseSensitive()
truepublic final String getAttributeNS(String namespaceURI, String localName)
ATTRIBUTE_NOT_DEFINED
if the attribute wasn't specified or ATTRIBUTE_VALUE_EMPTY if the
attribute was specified but it was empty.getAttributeNS in interface ElementnamespaceURI - the URI that identifies an XML namespacelocalName - the name within the namespaceATTRIBUTE_NOT_DEFINED or ATTRIBUTE_VALUE_EMPTYpublic DomAttr getAttributeNode(String name)
getAttributeNode in interface Elementpublic DomAttr getAttributeNodeNS(String namespaceURI, String localName)
getAttributeNodeNS in interface Elementpublic DomNodeList<HtmlElement> getElementsByTagName(String tagName)
getElementsByTagName in interface Elementpublic DomNodeList<HtmlElement> getElementsByTagNameNS(String namespace, String localName)
getElementsByTagNameNS in interface Elementpublic TypeInfo getSchemaTypeInfo()
getSchemaTypeInfo in interface Elementpublic void setIdAttribute(String name, boolean isId)
setIdAttribute in interface Elementpublic void setIdAttributeNS(String namespaceURI, String localName, boolean isId)
setIdAttributeNS in interface Elementpublic Attr setAttributeNode(Attr attribute)
setAttributeNode in interface Elementpublic Attr setAttributeNodeNS(Attr attribute)
setAttributeNodeNS in interface Elementpublic final void setIdAttributeNode(Attr idAttr, boolean isId)
setIdAttributeNode in interface Elementpublic DomNode cloneNode(boolean deep)
public final String getId()
public DomElement getFirstElementChild()
getFirstElementChild in interface ElementTraversalpublic DomElement getLastElementChild()
getLastElementChild in interface ElementTraversalpublic DomElement getPreviousElementSibling()
getPreviousElementSibling in interface ElementTraversalpublic DomElement getNextElementSibling()
getNextElementSibling in interface ElementTraversalpublic int getChildElementCount()
getChildElementCount in interface ElementTraversalpublic final Iterable<DomElement> getChildElements()
Copyright © 2002–2014 Gargoyle Software Inc.. All rights reserved.