Java XML Attribute Read readIntegerAttribute(Element elem, String name, int defaultValue)

Here you can find the source of readIntegerAttribute(Element elem, String name, int defaultValue)

Description

read Integer Attribute

License

Open Source License

Declaration

public static int readIntegerAttribute(Element elem, String name, int defaultValue) 

Method Source Code


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

public class Main {
    public static int readIntegerAttribute(Element elem, String name, int defaultValue) {
        int back = defaultValue;

        String str = elem.getAttribute(name);
        if (str != null) {
            if (str.length() > 0) {
                back = Integer.parseInt(str);
            }//from  www . ja  v a 2 s.c  o m
        }

        return back;
    }
}

Related

  1. readBooleanAttributeElement(final XMLStreamReader reader, final String attributeName)
  2. readFloat(Node node, String attributeName, float def)
  3. readFloatAttribute(XMLStreamReader reader, String attributeName)
  4. readInt(Node node, String attributeName, int def)
  5. readIntAttr(Element element, String attributeName, int defaultValue)
  6. readNodeAttributes(Element elem, Object[] map)