|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.cam.ch.wwmm.opsin.XOMTools
public final class XOMTools
Accessory functions for the manipulation of XOM Nodes/Elements Only those that are necessary for OPSIN's execution
Constructor Summary | |
---|---|
XOMTools()
|
Method Summary | |
---|---|
static int[] |
countNumberOfElementsAndNumberOfChildLessElements(nu.xom.Element startingElement)
Finds and returns the number of elements and the number of elements with no children, that are descendants of the startingElement The 0th position of the returned array is the total number of elements The 1st position is the number of child less elements |
static java.util.List<nu.xom.Element> |
getChildElementsWithTagName(nu.xom.Element startingElement,
java.lang.String elementName)
Finds all child elements whose localname matches one of the strings in elementNames Equivalent to an xpath of type ./*[local-name() = 'elementName'] from the startingElement This is equivalent to XOM's getChildElements(String) other than returning an arrayList |
static java.util.List<nu.xom.Element> |
getChildElementsWithTagNameAndAttribute(nu.xom.Element startingElement,
java.lang.String elementName,
java.lang.String attributeName,
java.lang.String attributeValue)
Finds all child elements whose localname matches the given elementName Additionally the element must have the specified attribute and the value of the attribute must be as specified Equivalent to an xpath of type ./*[local-name() = 'elementName'][@attribute="attributevalue"] from the startingElement |
static java.util.List<nu.xom.Element> |
getChildElementsWithTagNames(nu.xom.Element startingElement,
java.lang.String[] elementNames)
Finds all child elements whose localname matches one of the strings in elementNames Equivalent to an xpath of type ./*[local-name() = 'elementName1']|./*[local-name() = 'elementName2']|./*[local-name() = 'elementName3'] from the startingElement |
static java.util.List<nu.xom.Element> |
getDescendantElementsWithTagName(nu.xom.Element startingElement,
java.lang.String elementName)
Finds all descendant elements whose localname matches the given elementName Equivalent to an xpath of type .//*[local-name() = 'elementName'] from the startingElement |
static java.util.List<nu.xom.Element> |
getDescendantElementsWithTagNameAndAttribute(nu.xom.Element startingElement,
java.lang.String elementName,
java.lang.String attributeName,
java.lang.String attributeValue)
Finds all descendant elements whose localname matches the given elementName Additionally the element must have the specified attribute and the value of the attribute must be as specified Equivalent to an xpath of type .//*[local-name() = 'elementName'][@attribute="attributevalue"] from the startingElement |
static java.util.List<nu.xom.Element> |
getDescendantElementsWithTagNames(nu.xom.Element startingElement,
java.lang.String[] elementNames)
Finds all descendant elements whose localname matches one of the strings in elementNames Equivalent to an xpath of type .//*[local-name() = 'elementName1']|.//*[local-name() = 'elementName2']|.//*[local-name() = 'elementName3'] from the startingElement |
static nu.xom.Node |
getNext(nu.xom.Node node)
Gets the next node. |
static java.util.List<nu.xom.Element> |
getNextAdjacentSiblingsOfType(nu.xom.Element currentElem,
java.lang.String type)
Returns an arrayList containing sibling elements of the given type after the given element. |
static nu.xom.Node |
getNextSibling(nu.xom.Node node)
Gets the next sibling of a given node. |
static nu.xom.Node |
getNextSibling(nu.xom.Node current,
java.lang.String tagName)
Gets the first next sibling of a given node whose tagname matches the given string. |
static nu.xom.Element |
getNextSiblingIgnoringCertainElements(nu.xom.Element startingEl,
java.lang.String[] elementsToIgnore)
Gets the next sibling element of the given element. |
static java.util.List<nu.xom.Element> |
getNextSiblingsOfType(nu.xom.Element currentElem,
java.lang.String type)
Returns an arrayList containing sibling elements of the given type after the given element. |
static java.util.List<nu.xom.Element> |
getNextSiblingsOfTypes(nu.xom.Element currentElem,
java.lang.String[] types)
Returns an arrayList containing sibling elements of the given types after the given element. |
static nu.xom.Node |
getPrevious(nu.xom.Node node)
Gets the previous node. |
static nu.xom.Node |
getPreviousSibling(nu.xom.Node node)
Gets the previous sibling of a given node. |
static nu.xom.Node |
getPreviousSibling(nu.xom.Node current,
java.lang.String tagName)
Gets the first previous sibling of a given node whose tagname matches the given string. |
static nu.xom.Element |
getPreviousSiblingIgnoringCertainElements(nu.xom.Element startingEl,
java.lang.String[] elementsToIgnore)
Gets the previous sibling element of the given element. |
static java.util.List<nu.xom.Element> |
getPreviousSiblingsOfType(nu.xom.Element currentElem,
java.lang.String type)
Returns an arrayList containing sibling elements of the given type before the given element. |
static java.util.List<nu.xom.Element> |
getSiblingsUpToElementWithTagName(nu.xom.Element startingEl,
java.lang.String tagName)
Find all the later siblings of startingElement with the search terminating at the element with string tagName or if there are not more siblings |
static void |
insertAfter(nu.xom.Node node,
nu.xom.Node newNode)
Inserts a node so that it occurs after a reference node. |
static void |
insertBefore(nu.xom.Node node,
nu.xom.Node newNode)
Inserts a node so that it occurs before a reference node. |
static void |
setTextChild(nu.xom.Element group,
java.lang.String newName)
Sets the first text child of the group to the newName Throws an exception if the first child is not a Text node |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XOMTools()
Method Detail |
---|
public static nu.xom.Node getNextSibling(nu.xom.Node node)
node
- The reference node.
public static nu.xom.Node getNextSibling(nu.xom.Node current, java.lang.String tagName)
current
- The reference node.tagName
- The tagname of a node to look for
public static nu.xom.Node getPreviousSibling(nu.xom.Node node)
node
- The reference node.
public static nu.xom.Node getPreviousSibling(nu.xom.Node current, java.lang.String tagName)
current
- The reference node.tagName
- The tagname of a node to look for
public static void insertBefore(nu.xom.Node node, nu.xom.Node newNode)
node
- The reference node.newNode
- The new node to insert.public static void insertAfter(nu.xom.Node node, nu.xom.Node newNode)
node
- The reference node.newNode
- The new node to insert.public static nu.xom.Node getNext(nu.xom.Node node)
node:
- starting node
public static nu.xom.Node getPrevious(nu.xom.Node node)
node:
- starting node
public static void setTextChild(nu.xom.Element group, java.lang.String newName)
group
- newName
- public static java.util.List<nu.xom.Element> getNextSiblingsOfType(nu.xom.Element currentElem, java.lang.String type)
currentElem:
- the element to look for following siblings oftype:
- the "localname" of the element type desired
public static java.util.List<nu.xom.Element> getNextAdjacentSiblingsOfType(nu.xom.Element currentElem, java.lang.String type)
currentElem:
- the element to look for following siblings oftype:
- the "localname" of the element type desired
public static java.util.List<nu.xom.Element> getNextSiblingsOfTypes(nu.xom.Element currentElem, java.lang.String[] types)
currentElem:
- the element to look for following siblings oftypes:
- An array of the "localname"s of the element types desired
public static java.util.List<nu.xom.Element> getPreviousSiblingsOfType(nu.xom.Element currentElem, java.lang.String type)
currentElem:
- the element to look for previous siblings oftype:
- the "localname" of the element type desired
public static nu.xom.Element getNextSiblingIgnoringCertainElements(nu.xom.Element startingEl, java.lang.String[] elementsToIgnore)
startingEl
- elementsToIgnore
-
public static nu.xom.Element getPreviousSiblingIgnoringCertainElements(nu.xom.Element startingEl, java.lang.String[] elementsToIgnore)
startingEl
- elementsToIgnore
-
public static java.util.List<nu.xom.Element> getDescendantElementsWithTagName(nu.xom.Element startingElement, java.lang.String elementName)
startingElement
- elementName
-
public static java.util.List<nu.xom.Element> getDescendantElementsWithTagNames(nu.xom.Element startingElement, java.lang.String[] elementNames)
startingElement
- elementNames
-
public static java.util.List<nu.xom.Element> getChildElementsWithTagNames(nu.xom.Element startingElement, java.lang.String[] elementNames)
startingElement
- elementNames
-
public static java.util.List<nu.xom.Element> getChildElementsWithTagName(nu.xom.Element startingElement, java.lang.String elementName)
startingElement
- elementName
-
public static java.util.List<nu.xom.Element> getDescendantElementsWithTagNameAndAttribute(nu.xom.Element startingElement, java.lang.String elementName, java.lang.String attributeName, java.lang.String attributeValue)
startingElement
- elementName
-
public static java.util.List<nu.xom.Element> getChildElementsWithTagNameAndAttribute(nu.xom.Element startingElement, java.lang.String elementName, java.lang.String attributeName, java.lang.String attributeValue)
startingElement
- elementName
-
public static int[] countNumberOfElementsAndNumberOfChildLessElements(nu.xom.Element startingElement)
startingElement
-
public static java.util.List<nu.xom.Element> getSiblingsUpToElementWithTagName(nu.xom.Element startingEl, java.lang.String tagName)
startingEl
- tagName
-
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |