|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjodd.lagarto.dom.Node
public abstract class Node
DOM node.
| Nested Class Summary | |
|---|---|
static class |
Node.NodeType
Node types. |
| Field Summary | |
|---|---|
protected java.util.List<Attribute> |
attributes
|
protected boolean |
caseSensitive
|
protected Node[] |
childElementNodes
|
protected int |
childElementNodesCount
|
protected java.util.List<Node> |
childNodes
|
protected int |
deepLevel
|
protected java.lang.String |
nodeName
|
protected Node.NodeType |
nodeType
|
protected java.lang.String |
nodeValue
|
protected Node |
parentNode
|
protected LagartoLexer.Position |
position
|
protected int |
siblingElementIndex
|
protected int |
siblingIndex
|
protected int |
siblingNameIndex
|
| Constructor Summary | |
|---|---|
protected |
Node(Node.NodeType nodeType,
java.lang.String nodeName,
boolean caseSensitive)
|
| Method Summary | ||
|---|---|---|
void |
addChild(Node... nodes)
Appends several child nodes at once. |
|
void |
addChild(Node node)
Appends child node. |
|
boolean |
check()
Checks the health of child nodes. |
|
abstract Node |
clone()
|
|
protected
|
cloneTo(T dest)
Copies all non-final values to the empty cloned object. |
|
void |
detachFromParent()
Removes this node from DOM tree. |
|
Attribute |
getAttribute(int index)
Returns attribute at given index or null if index not found. |
|
java.lang.String |
getAttribute(java.lang.String name)
Returns attribute value. |
|
protected Attribute |
getAttributeInstance(java.lang.String name)
|
|
int |
getAttributesCount()
Returns total number of attributes. |
|
Node |
getChild(int index)
Returns a child node at given index or null
if child doesn't exist for that index. |
|
Node |
getChildElement(int index)
Returns a child element node at given index. |
|
Node[] |
getChildElements()
Returns an array of all children elements. |
|
int |
getChildElementsCount()
Returns number of child elements. |
|
int |
getChildElementsCount(java.lang.String elementName)
Returns number of child elements with given name. |
|
Node[] |
getChildNodes()
Returns an array of all children nodes. |
|
int |
getChildNodesCount()
Returns number of all child nodes. |
|
java.lang.String |
getCssPath()
Returns CSS path to this node from document root. |
|
int |
getDeepLevel()
Returns deep level. |
|
Node |
getFirstChild()
Returns first child or null if no children exist. |
|
Node |
getFirstChildElement()
Returns first child element node or null if no element children exist. |
|
Node |
getFirstChildElement(java.lang.String elementName)
Returns first child element with given name or null if no such children exist. |
|
java.lang.String |
getHtml()
Generates HTML. |
|
java.lang.String |
getInnerHtml()
Generates inner HTML. |
|
Node |
getLastChild()
Returns last child or null if no children exist. |
|
Node |
getLastChildElement()
Returns last child element node or null if no such child node exist. |
|
Node |
getLastChildElement(java.lang.String elementName)
Returns last child element with given name or null if no such child node exist. |
|
Node |
getNextSibling()
Returns this node's next sibling of any type or null if this is the last sibling. |
|
Node |
getNextSiblingElement()
Returns this node's next element. |
|
Node |
getNextSiblingName()
Returns this node's next element with the same name. |
|
java.lang.String |
getNodeName()
Returns node name or null if name is not available. |
|
Node.NodeType |
getNodeType()
Returns node type. |
|
java.lang.String |
getNodeValue()
Returns node value or null if value is not available. |
|
Node |
getParentNode()
Returns parent node or null if no parent exist. |
|
Node |
getPreviousSibling()
Returns this node's previous sibling of any type or null if this is the first sibling. |
|
Node |
getPreviousSiblingElement()
Returns this node's previous sibling of element type or null if this is the first sibling. |
|
Node |
getPreviousSiblingName()
Returns this node's previous sibling element with the same name. |
|
int |
getSiblingElementIndex()
|
|
int |
getSiblingIndex()
Get the list index of this node in its node sibling list. |
|
int |
getSiblingNameIndex()
|
|
java.lang.String |
getTextContent()
Returns the text content of this node and its descendants. |
|
boolean |
hasAttribute(java.lang.String name)
Returns true if node contains an attribute. |
|
boolean |
hasAttributes()
Returns true if node has attributes. |
|
boolean |
hasChildNodes()
Returns true if node has child nodes. |
|
protected int |
indexOfAttributeInstance(java.lang.String name)
|
|
protected void |
initAttributes()
Initializes attributes when needed. |
|
protected void |
initChildElementNodes()
Initializes list of child elements. |
|
protected void |
initChildNodes()
Initializes child nodes list when needed. |
|
protected void |
initSiblingNames()
Initializes siblings elements of the same name. |
|
void |
insertAfter(Node newChild,
Node refChild)
Inserts node after provided node. |
|
void |
insertBefore(Node newChild,
Node refChild)
Inserts node before provided node. |
|
void |
insertChild(Node node,
int index)
Inserts node at given index. |
|
boolean |
isAttributeIncluding(java.lang.String name,
java.lang.String word)
Returns true if attribute includes some word. |
|
protected void |
reindexChildren()
Reindex children nodes. |
|
protected void |
reindexChildrenOnAdd(int addedCount)
Optimized variant of reindexChildren() for addition. |
|
void |
removeAllChilds()
Removes all child nodes. |
|
boolean |
removeAttribute(java.lang.String name)
|
|
Node |
removeChild(int index)
Removes child node at given index. |
|
void |
removeChild(Node childNode)
Removes child node. |
|
void |
setAttribute(java.lang.String name)
Sets attribute that doesn't need a value. |
|
void |
setAttribute(java.lang.String name,
java.lang.String value)
Sets attribute value. |
|
void |
setNodeValue(java.lang.String value)
Sets node value. |
|
void |
toHtml(java.lang.Appendable appendable)
Generates HTML by appending it to the provided Appendable. |
|
protected void |
toInnerHtml(java.lang.Appendable appendable)
|
|
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final java.lang.String nodeName
protected final Node.NodeType nodeType
protected final boolean caseSensitive
protected java.lang.String nodeValue
protected java.util.List<Attribute> attributes
protected Node parentNode
protected java.util.List<Node> childNodes
protected int childElementNodesCount
protected Node[] childElementNodes
protected int siblingIndex
protected int siblingElementIndex
protected int siblingNameIndex
protected int deepLevel
protected LagartoLexer.Position position
| Constructor Detail |
|---|
protected Node(Node.NodeType nodeType,
java.lang.String nodeName,
boolean caseSensitive)
| Method Detail |
|---|
protected <T extends Node> T cloneTo(T dest)
public abstract Node clone()
clone in class java.lang.Objectpublic Node.NodeType getNodeType()
node type.
public java.lang.String getNodeName()
null if name is not available.
public java.lang.String getNodeValue()
null if value is not available.
public void setNodeValue(java.lang.String value)
public void detachFromParent()
public void addChild(Node node)
reindexChildren().
public void addChild(Node... nodes)
public void insertChild(Node node,
int index)
public void insertBefore(Node newChild,
Node refChild)
public void insertAfter(Node newChild,
Node refChild)
public Node removeChild(int index)
null if index is invalid.
public void removeChild(Node childNode)
public void removeAllChilds()
public Node getParentNode()
null if no parent exist.
public boolean hasAttributes()
true if node has attributes.
public int getAttributesCount()
public Attribute getAttribute(int index)
null if index not found.
public boolean hasAttribute(java.lang.String name)
true if node contains an attribute.
public java.lang.String getAttribute(java.lang.String name)
null when
attribute doesn't exist or when attribute exist but doesn't
specify a value.
protected Attribute getAttributeInstance(java.lang.String name)
protected int indexOfAttributeInstance(java.lang.String name)
public boolean removeAttribute(java.lang.String name)
public void setAttribute(java.lang.String name,
java.lang.String value)
null.
public void setAttribute(java.lang.String name)
public boolean isAttributeIncluding(java.lang.String name,
java.lang.String word)
true if attribute includes some word.
public boolean hasChildNodes()
true if node has child nodes.
public int getChildNodesCount()
public int getChildElementsCount()
public int getChildElementsCount(java.lang.String elementName)
public Node[] getChildNodes()
public Node[] getChildElements()
public Node getChild(int index)
null
if child doesn't exist for that index.
public Node getChildElement(int index)
public Node getFirstChild()
null if no children exist.
public Node getFirstChildElement()
null if no element children exist.
public Node getFirstChildElement(java.lang.String elementName)
null if no such children exist.
public Node getLastChild()
null if no children exist.
public Node getLastChildElement()
null if no such child node exist.
public Node getLastChildElement(java.lang.String elementName)
null if no such child node exist.
public boolean check()
protected void reindexChildren()
childNodes list and:
protected void reindexChildrenOnAdd(int addedCount)
reindexChildren() for addition.
Only added children are optimized.
protected void initChildElementNodes()
protected void initSiblingNames()
protected void initAttributes()
protected void initChildNodes()
public int getSiblingIndex()
public int getSiblingElementIndex()
public int getSiblingNameIndex()
public Node getNextSibling()
null if this is the last sibling.
public Node getNextSiblingElement()
public Node getNextSiblingName()
public Node getPreviousSibling()
null if this is the first sibling.
public Node getPreviousSiblingElement()
null if this is the first sibling.
public Node getPreviousSiblingName()
public java.lang.String getTextContent()
public java.lang.String getHtml()
public java.lang.String getInnerHtml()
public void toHtml(java.lang.Appendable appendable)
throws java.io.IOException
Appendable.
java.io.IOException
protected void toInnerHtml(java.lang.Appendable appendable)
throws java.io.IOException
java.io.IOExceptionpublic int getDeepLevel()
public java.lang.String getCssPath()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||