Code example for Node

Methods: getAttributes

0
     * @param elem a node from DOM tree. 
     * @param attrName the attribute name. 
     * @return string value of the attribute name from the DOM node. 
     */ 
    static public String getStringAttributeValue(Node elem, String attrName) {
        Node node = elem.getAttributes().getNamedItem(attrName);
        if (node == null) {
            return null; 
        } 
        return node.getNodeValue().trim();
    } 
 
    /** 
     * Get integer attribute value. 
     * 
     * @param elem The element node. 
     * @param attrName The attribute name. 
     * @return The attribute value in integer. 
     */ 
    protected int getAttributeValue(Node elem, String attrName) {