Search in sources :

Example 1 with NodeSet

use of org.apache.xpath.NodeSet in project robovm by robovm.

the class DTMNodeProxy method getElementsByTagNameNS.

/**
   *
   * @param namespaceURI
   * @param localName
   *
   *
   * @see org.w3c.dom.Document as of DOM Level 2
   */
public final NodeList getElementsByTagNameNS(String namespaceURI, String localName) {
    Vector listVector = new Vector();
    Node retNode = dtm.getNode(node);
    if (retNode != null) {
        boolean isNamespaceURIWildCard = "*".equals(namespaceURI);
        boolean isLocalNameWildCard = "*".equals(localName);
        if (DTM.ELEMENT_NODE == retNode.getNodeType()) {
            NodeList nodeList = retNode.getChildNodes();
            for (int i = 0; i < nodeList.getLength(); i++) {
                traverseChildren(listVector, nodeList.item(i), namespaceURI, localName, isNamespaceURIWildCard, isLocalNameWildCard);
            }
        } else if (DTM.DOCUMENT_NODE == retNode.getNodeType()) {
            traverseChildren(listVector, dtm.getNode(node), namespaceURI, localName, isNamespaceURIWildCard, isLocalNameWildCard);
        }
    }
    int size = listVector.size();
    NodeSet nodeSet = new NodeSet(size);
    for (int i = 0; i < size; i++) {
        nodeSet.addNode((Node) listVector.elementAt(i));
    }
    return (NodeList) nodeSet;
}
Also used : NodeSet(org.apache.xpath.NodeSet) Node(org.w3c.dom.Node) NodeList(org.w3c.dom.NodeList) Vector(java.util.Vector)

Example 2 with NodeSet

use of org.apache.xpath.NodeSet in project robovm by robovm.

the class DTMNodeProxy method getElementsByTagName.

/**
   *
   * @param tagname
   *
   *
   * @see org.w3c.dom.Document
   */
public final NodeList getElementsByTagName(String tagname) {
    Vector listVector = new Vector();
    Node retNode = dtm.getNode(node);
    if (retNode != null) {
        boolean isTagNameWildCard = "*".equals(tagname);
        if (DTM.ELEMENT_NODE == retNode.getNodeType()) {
            NodeList nodeList = retNode.getChildNodes();
            for (int i = 0; i < nodeList.getLength(); i++) {
                traverseChildren(listVector, nodeList.item(i), tagname, isTagNameWildCard);
            }
        } else if (DTM.DOCUMENT_NODE == retNode.getNodeType()) {
            traverseChildren(listVector, dtm.getNode(node), tagname, isTagNameWildCard);
        }
    }
    int size = listVector.size();
    NodeSet nodeSet = new NodeSet(size);
    for (int i = 0; i < size; i++) {
        nodeSet.addNode((Node) listVector.elementAt(i));
    }
    return (NodeList) nodeSet;
}
Also used : NodeSet(org.apache.xpath.NodeSet) Node(org.w3c.dom.Node) NodeList(org.w3c.dom.NodeList) Vector(java.util.Vector)

Example 3 with NodeSet

use of org.apache.xpath.NodeSet in project j2objc by google.

the class DTMNodeProxy method getElementsByTagName.

/**
   *
   * @param tagname
   *
   *
   * @see org.w3c.dom.Document
   */
public final NodeList getElementsByTagName(String tagname) {
    Vector listVector = new Vector();
    Node retNode = dtm.getNode(node);
    if (retNode != null) {
        boolean isTagNameWildCard = "*".equals(tagname);
        if (DTM.ELEMENT_NODE == retNode.getNodeType()) {
            NodeList nodeList = retNode.getChildNodes();
            for (int i = 0; i < nodeList.getLength(); i++) {
                traverseChildren(listVector, nodeList.item(i), tagname, isTagNameWildCard);
            }
        } else if (DTM.DOCUMENT_NODE == retNode.getNodeType()) {
            traverseChildren(listVector, dtm.getNode(node), tagname, isTagNameWildCard);
        }
    }
    int size = listVector.size();
    NodeSet nodeSet = new NodeSet(size);
    for (int i = 0; i < size; i++) {
        nodeSet.addNode((Node) listVector.elementAt(i));
    }
    return (NodeList) nodeSet;
}
Also used : NodeSet(org.apache.xpath.NodeSet) Node(org.w3c.dom.Node) NodeList(org.w3c.dom.NodeList) Vector(java.util.Vector)

Example 4 with NodeSet

use of org.apache.xpath.NodeSet in project j2objc by google.

the class DTMNodeProxy method getElementsByTagNameNS.

/**
   *
   * @param namespaceURI
   * @param localName
   *
   *
   * @see org.w3c.dom.Document as of DOM Level 2
   */
public final NodeList getElementsByTagNameNS(String namespaceURI, String localName) {
    Vector listVector = new Vector();
    Node retNode = dtm.getNode(node);
    if (retNode != null) {
        boolean isNamespaceURIWildCard = "*".equals(namespaceURI);
        boolean isLocalNameWildCard = "*".equals(localName);
        if (DTM.ELEMENT_NODE == retNode.getNodeType()) {
            NodeList nodeList = retNode.getChildNodes();
            for (int i = 0; i < nodeList.getLength(); i++) {
                traverseChildren(listVector, nodeList.item(i), namespaceURI, localName, isNamespaceURIWildCard, isLocalNameWildCard);
            }
        } else if (DTM.DOCUMENT_NODE == retNode.getNodeType()) {
            traverseChildren(listVector, dtm.getNode(node), namespaceURI, localName, isNamespaceURIWildCard, isLocalNameWildCard);
        }
    }
    int size = listVector.size();
    NodeSet nodeSet = new NodeSet(size);
    for (int i = 0; i < size; i++) {
        nodeSet.addNode((Node) listVector.elementAt(i));
    }
    return (NodeList) nodeSet;
}
Also used : NodeSet(org.apache.xpath.NodeSet) Node(org.w3c.dom.Node) NodeList(org.w3c.dom.NodeList) Vector(java.util.Vector)

Aggregations

Vector (java.util.Vector)4 NodeSet (org.apache.xpath.NodeSet)4 Node (org.w3c.dom.Node)4 NodeList (org.w3c.dom.NodeList)4