Here you can find the source of getAttributeValue(StartElement startElement, String attributeName)
Parameter | Description |
---|---|
startElement | a parameter |
attributeName | a parameter |
private static String getAttributeValue(StartElement startElement, String attributeName)
//package com.java2s; //License from project: Open Source License import javax.xml.namespace.QName; import javax.xml.stream.events.Attribute; import javax.xml.stream.events.StartElement; public class Main { /**/*from w w w. ja v a 2s . c om*/ * Gets the value of a given attribute * @param startElement * @param attributeName * @return */ private static String getAttributeValue(StartElement startElement, String attributeName) { String value = null; Attribute idAttr = startElement.getAttributeByName(new QName(attributeName)); if (idAttr != null) { value = idAttr.getValue(); } return value; } }