code: public static float optionalFloatAttribute(
              final XMLStreamReader reader,
              final String namespace,
              final String localName,
              final float defaultValue) {
          final String value = reader.getAttributeValue(namespace, localName);
          if (value != null) {
              return Float.parseFloat(value);
          }
          return defaultValue;
      }
docs: Returns the value of an attribute as a float. If the attribute is empty, this method returns
  the default value provided.
  
  @param reader
  <code>XMLStreamReader</code> that contains attribute values.
  @param namespace
  String
  @param localName
  local name of attribute (the namespace is ignored).
  @param defaultValue
  default value
  @return value of attribute, or the default value if the attribute is empty.