Java XML Attribute from Node getIntAttributeValue(Node node, String attribute)

Here you can find the source of getIntAttributeValue(Node node, String attribute)

Description

get Int Attribute Value

License

Open Source License

Declaration

public static Integer getIntAttributeValue(Node node, String attribute) 

Method Source Code


//package com.java2s;
import org.w3c.dom.Node;

public class Main {
    public static Integer getIntAttributeValue(Node node, String attribute) {
        String value = getAttributeValue(node, attribute);

        if (value == null)
            return null;

        return Integer.parseInt(value);
    }/*  www  .  j  a v a2 s.co  m*/

    public static String getAttributeValue(Node node, String attribute) {
        Node att = node.getAttributes().getNamedItem(attribute);

        if (att == null)
            return null;

        return att.getTextContent();
    }
}

Related

  1. getIntAttribute(Node n, String s)
  2. getIntAttribute(Node node, String attr)
  3. getIntAttribute(Node node, String attributeName, int defaultValue)
  4. getIntAttribute(Node node, String name, int defVal)
  5. getIntAttributeRequired(Node node, String attributeName)
  6. getIntAttrId(Node aNode, String aAttrName)
  7. getIntegerAttribute(Node n, String attributeName)
  8. getIntegerAttribute(Node node, String att_name)
  9. getLongAttributeByName(Node node, String name, long defaultValue)