|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.itsnat.core.domutil.ItsNatTreeWalker
public class ItsNatTreeWalker
Utility class used to easily iterate a DOM tree, specially DOM elements.
Most of methods have been inspired by org.w3c.dom.traversal.TreeWalker.
| Constructor Summary | |
|---|---|
ItsNatTreeWalker()
|
|
| Method Summary | |
|---|---|
static int |
getChildElementCount(org.w3c.dom.Node node)
Returns the number of child elements of the specified node. |
static org.w3c.dom.Element |
getFirstChildElement(org.w3c.dom.Node node)
Returns the first direct child org.w3c.dom.Element below the specified node. |
static org.w3c.dom.Element |
getFirstChildElementWithTagName(org.w3c.dom.Node parent,
java.lang.String tagName)
Returns the first direct child element with the specified tag name. |
static org.w3c.dom.Element |
getFirstChildElementWithTagNameNS(org.w3c.dom.Node parent,
java.lang.String namespaceURI,
java.lang.String localName)
Returns the first direct child element with the specified namespace and local name. |
static org.w3c.dom.Element |
getFirstDeepestChildElement(org.w3c.dom.Node node)
Returns the first and deepest element below the specified node. |
static org.w3c.dom.Element |
getLastChildElement(org.w3c.dom.Node node)
Returns the last direct child org.w3c.dom.Element below the specified node. |
static org.w3c.dom.Element |
getNextElement(org.w3c.dom.Node node)
Returns the next org.w3c.dom.Element following the specified node in document order. |
static org.w3c.dom.Node |
getNextNode(org.w3c.dom.Node node)
Returns the next node following the specified node in document order. |
static org.w3c.dom.Element |
getNextSiblingElement(org.w3c.dom.Node node)
Returns the next sibling org.w3c.dom.Element following the specified node. |
static org.w3c.dom.Element |
getParentElement(org.w3c.dom.Node node)
Returns the first parent org.w3c.dom.Element of specified node. |
static org.w3c.dom.Element |
getPreviousElement(org.w3c.dom.Node node)
Returns the previous org.w3c.dom.Element following the specified node in document order. |
static org.w3c.dom.Node |
getPreviousNode(org.w3c.dom.Node node)
Returns the previous node following the specified node in document order. |
static org.w3c.dom.Element |
getPreviousSiblingElement(org.w3c.dom.Node node)
Returns the previous sibling org.w3c.dom.Element following the specified node. |
static boolean |
hasChildElements(org.w3c.dom.Node node)
Informs whether the specified node has child elements. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ItsNatTreeWalker()
| Method Detail |
|---|
public static boolean hasChildElements(org.w3c.dom.Node node)
node - the node to inspect.
public static int getChildElementCount(org.w3c.dom.Node node)
node - the node to inspect.
public static org.w3c.dom.Element getFirstChildElement(org.w3c.dom.Node node)
org.w3c.dom.Element below the specified node.
Any child non-element is ignored.
node - the node parent.
public static org.w3c.dom.Element getLastChildElement(org.w3c.dom.Node node)
org.w3c.dom.Element below the specified node.
Any child non-element is ignored.
node - the node parent.
public static org.w3c.dom.Element getNextSiblingElement(org.w3c.dom.Node node)
org.w3c.dom.Element following the specified node.
Any non-element is ignored.
node - the original node.
public static org.w3c.dom.Element getPreviousSiblingElement(org.w3c.dom.Node node)
org.w3c.dom.Element following the specified node.
Any non-element is ignored.
node - the original node.
public static org.w3c.dom.Element getParentElement(org.w3c.dom.Node node)
org.w3c.dom.Element of specified node.
Any non-element parent is ignored.
node - the original node.
public static org.w3c.dom.Element getPreviousElement(org.w3c.dom.Node node)
org.w3c.dom.Element following the specified node in document order.
Any non-element is ignored.
node - the original node.
public static org.w3c.dom.Element getNextElement(org.w3c.dom.Node node)
org.w3c.dom.Element following the specified node in document order.
Any non-element is ignored.
node - the original node.
public static org.w3c.dom.Node getPreviousNode(org.w3c.dom.Node node)
node - the original node.
public static org.w3c.dom.Node getNextNode(org.w3c.dom.Node node)
node - the original node.
public static org.w3c.dom.Element getFirstChildElementWithTagName(org.w3c.dom.Node parent,
java.lang.String tagName)
parent - the parent node.tagName - the tag name to search for, the search is case sensitive.
public static org.w3c.dom.Element getFirstChildElementWithTagNameNS(org.w3c.dom.Node parent,
java.lang.String namespaceURI,
java.lang.String localName)
parent - the parent node.namespaceURI - the namespace of the element to search for, the search is case sensitive.localName - the local name of the element to search for, the search is case sensitive.
public static org.w3c.dom.Element getFirstDeepestChildElement(org.w3c.dom.Node node)
For instance if node is the <table> element:
<table>
<tbody>
<tr>
<td>One</td>
</tr>
<tr>
<td>Two</td>
</tr>
</tbody>
</table>
Returns the <td> element parent of One
node - the parent node to search.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||