Java XML Attribute Get getAttributeValue(StartElement element, String namespaceURI, String localPart)

Here you can find the source of getAttributeValue(StartElement element, String namespaceURI, String localPart)

Description

get Attribute Value

License

Open Source License

Declaration

public static String getAttributeValue(StartElement element, String namespaceURI, String localPart) 

Method Source Code


//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();
    }/*from   w  ww  . j a v  a2  s . co m*/
}

Related

  1. getAttributeValue(Node node, String name, boolean defaultValue)
  2. getAttributeValue(Node node, String name, String defaultValue)
  3. getAttributeValue(Node sNode, String attribName)
  4. getAttributeValue(Node sNode, String attribName)
  5. getAttributeValue(NodeList elements, String attributeName)
  6. getAttributeValue(StartElement startElement, String attributeName)
  7. getAttributeValue(String attributeName, Node xmlNode)
  8. getAttributeValueAsBoolean(Attr attribute)
  9. getAttributeValueAsBoolean(Element el, String attrName)