Here you can find the source of getAttributeByLocalName(XMLStreamReader reader, String localName)
public static String getAttributeByLocalName(XMLStreamReader reader, String localName)
//package com.java2s; //License from project: Apache License import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamReader; public class Main { public static String getAttributeByLocalName(XMLStreamReader reader, String localName) { String result = ""; for (int i = 0; i < reader.getAttributeCount(); i++) { QName attribute = reader.getAttributeName(i); if (attribute != null && attribute.getLocalPart().equals(localName)) { result = reader.getAttributeValue(i); }/*from w ww . j ava2 s . com*/ } return result; } }