Java tutorial
//package com.java2s; //License from project: Open Source License import javax.xml.XMLConstants; import javax.xml.namespace.QName; import javax.xml.stream.events.*; public class Main { public static String getAttributeValue(StartElement element, String namespaceURI, String localPart) { QName name = new QName(namespaceURI == null ? XMLConstants.NULL_NS_URI : namespaceURI, localPart); Attribute attribute = element.getAttributeByName(name); return attribute == null ? null : attribute.getValue(); } }