Java XML NodeList getNodeList(Node node, String tagName)

Here you can find the source of getNodeList(Node node, String tagName)

Description

get Node List

License

GNU General Public License

Declaration

public static NodeList getNodeList(Node node, String tagName) 

Method Source Code

//package com.java2s;
/*//  ww  w  .  j a  v  a 2 s  .c om
 * ??? ????????? ? ??? ???????? ?????????? ??????? ? ?????????? ???????
 * 
 * ???????? ? 2010-2016, CompuProject ?/??? ???????? ????????.
 * ???? ????? ????????.
 * 
 * ShopImportDeamon ???? ??????????? ???????????? ???????????????? ? ????????????? 
 * CompuProject ? ?????? ??????? ApelsinShop ??? ????? ???? ?????????? ?????????.
 * 
 * ?????????????????, ?????????????? ?????????? ???? ? ????? ????? ?/??? ??? 
 * ???????????? ????????????? ??? ????????, ??? ?????????????? ?????????? ?????????:
 * 
 * 1. ??? ????????????????? ?????????? ???? ?????? ????????????? ????????? ???? 
 *    ??????????? ?? ?????????? ??????, ????? ???????? ???????? ? ???????????? 
 *    ????? ?? ????????.
 * 
 * 2. ??? ????????? ?????????? ???? ?????? ????????????? ????????? ???? 
 *    ??????????? ?? ?????????? ??????, ????? ???????? ????????, ???????????? 
 *    ????? ?? ???????? ? ??????? ? ?????????? ???????????.
 * 
 * 3. ????????????????? ?/??? ????????? ?????????? ???? ?????? ????????????
 *    ?? ?????????? ??????????? ????????????? ???????? GNU ? ??? ????, ? ????? 
 *    ??? ???? ???????????? ?????? ??????????? ???????????? ?????????????;
 *    ???? ???????? ??????? 3, ???? (?? ?????? ??????) ????? ????? ???????
 *    ???????. ?? ?????? ???? ???????? ????? ??????????? ????????????? 
 *    ???????? GNU ??????? ?? ????? ??????????. ????? ???? ?? ???, ???. 
 *    <http://www.gnu.org/licenses/>.
 * 
 * ShopImportDeamon ????????????????????? ? ???????, ??? ??? ????? ????????,
 * ?? ???? ?????? ???????????; ???? ??? ???????? ???????? ??????????? ?????
 * ??? ???????????? ??? ?????????????? ?????. ????????? ???. ? ???????????
 * ????????????? ???????? GNU.
 * 
 * ??? ??? ?????? ???????? ??????, ??? ??????????? ??? CompuProject ??? 
 * ?????? ????????????????? ??? ?????? ???? ??????, ???????????, ???????????, 
 * ??????, ?????????? ??? ?????? ???? ?????? ?????? (????????, ??? ??? 
 * ???????????????? ?????????????? ??? ????????? ???????? ? ?????; ??????? 
 * ????????? ??? ???????; ?????????????????? ?????????). 
 * 
 * ??????????????? ?????????? ?????????? ????? ???????????, ??? ?? ???? ???????????????
 * ?? ????? ?????????, ??????????????? ? ?????????, ?????????????? ????, ?????????? ? ?????
 * ? ?????????? ?? ??????????.
 * 
 * ???? ?? ??? ?????????? ? ?????????????????? ?????????, ??????????????? ? ?????????, 
 * ?? ?? ?????? ???????????? ?? ??????????????? ?????????? ?????????? ?????.
 * 
 */

import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class Main {

    public static NodeList getNodeList(Node node, String tagName) {
        return getNodeList(NodeToElement(node), tagName);
    }

    public static NodeList getNodeList(Element element, String tagName) {
        return element.getElementsByTagName(tagName);
    }

    public static Element NodeToElement(Node node) {
        if (node.getNodeType() == Node.ELEMENT_NODE) {
            return (Element) node;
        }
        return null;
    }
}

Related

  1. getNodeFromNodeList(NodeList nl, String nodeName, int index)
  2. getNodeFromNodeList(NodeList nodeList)
  3. getNodeIntValue(String tagName, NodeList nodes)
  4. getNodeList(Element from, String elementName)
  5. getNodeList(Node fatherNode, String nodeName)
  6. getNodeList(Node pNode, String tagName)
  7. getNodeList(NodeList nl, String[] names, int pos)
  8. getNodeList(NodeList nodeList)
  9. getNodeList(NodeList nodeList)