Here you can find the source of floatAttr(final XmlPullParser pp, final String attrName)
public static double floatAttr(final XmlPullParser pp, final String attrName)
//package com.java2s; /*// w w w .j ava 2 s . co m * For license please see accompanying LICENSE.txt file (available also at http://www.xmlpull.org/). * According to www.xmlpull.org, this code is in the public domain. */ import org.xmlpull.v1.XmlPullParser; public class Main { public static double floatAttr(final XmlPullParser pp, final String attrName) { return Double.parseDouble(attr(pp, attrName)); } public static String attr(final XmlPullParser pp, final String attrName) { final String attr = optAttr(pp, attrName, null); if (attr != null) return attr; else throw new IllegalStateException("expecting attribute: " + attrName); } public static String optAttr(final XmlPullParser pp, final String attrName, final String defaultValue) { final String attr = pp.getAttributeValue(null, attrName); if (attr != null) { final String trimmedAttr = attr.trim(); if (trimmedAttr.length() > 0) return trimmedAttr; } return defaultValue; } }