Java tutorial
//package com.java2s; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamReader; public class Main { /** * Returns the value of the attribute with the given non-qualified name. * * @param reader The xml stream reader * @param name The name of the attribute. * @return The value of the unqualified attribute, or <code>null</code> * if the attribute wasn't present. */ public static final String attributeValue(XMLStreamReader reader, String name) { return reader.getAttributeValue("", name); } /** * Returns the value of the attribute with the given name. * * @param reader The xml stream reader * @param name The name of the attribute. * @return The value of the attribute, or <code>null</code> if the * attribute wasn't present. */ public static final String attributeValue(XMLStreamReader reader, QName name) { return reader.getAttributeValue(name.getNamespaceURI(), name.getLocalPart()); } }