Code example for NodeList

Methods: getLength, item

0
        return HTMLEntity.unescape(getTextContent(str,elem));
    } 
 
    protected static String getTextContent(String str, Element elem){
        NodeList nodelist = elem.getElementsByTagName(str);
        if (nodelist.getLength() > 0) {
            Node node = nodelist.item(0).getFirstChild();
            if (null != node) {
                String nodeValue = node.getNodeValue();
                return null != nodeValue ? nodeValue : "";
            } 
        } 
        return ""; 
     } 
 
    /*modify by sycheng  add "".equals(str) */ 
    protected static int getChildInt(String str, Element elem) {
        String str2 = getTextContent(str, elem);
        if (null == str2 || "".equals(str2)||"null".equals(str)) {
            return -1; 
        } else {