Java XML Attribute By QName getAttributeValue(final XMLStreamReader streamReader, final QName name)

Here you can find the source of getAttributeValue(final XMLStreamReader streamReader, final QName name)

Description

Get the value of the specified attribute.

License

Open Source License

Parameter

Parameter Description
streamReader The current XML stream reader.
name The name of the attribute.

Return

The value of the attribute.

Declaration

public static String getAttributeValue(final XMLStreamReader streamReader, final QName name) 

Method Source Code


//package com.java2s;
/*/*from   w w  w  .  j  ava  2s. co  m*/
 * JBoss, Home of Professional Open Source
 * Copyright 2006, Red Hat Middleware LLC, and individual contributors
 * as indicated by the @author tags. 
 * See the copyright.txt in the distribution for a full listing 
 * of individual contributors.
 * This copyrighted material is made available to anyone wishing to use,
 * modify, copy, or redistribute it subject to the terms and conditions
 * of the GNU General Public License, v. 2.0.
 * This program is distributed in the hope that it will be useful, but WITHOUT A 
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
 * PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License,
 * v. 2.0 along with this distribution; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
 * MA  02110-1301, USA.
 * 
 * (C) 2005-2006,
 * @author JBoss Inc.
 */

import javax.xml.namespace.QName;

import javax.xml.stream.XMLStreamReader;

public class Main {
    /**
     * Get the value of the specified attribute.
     * @param streamReader The current XML stream reader.
     * @param name The name of the attribute.
     * @return The value of the attribute.
     */
    public static String getAttributeValue(final XMLStreamReader streamReader, final QName name) {
        return streamReader.getAttributeValue(name.getNamespaceURI(), name.getLocalPart());
    }
}

Related

  1. getAttribute(Element el, QName attributeName)
  2. getAttribute(Element xml, QName qname)
  3. getAttributeAsQName(XMLStreamReader reader, String name)
  4. getAttributeValueAsQName(final Element el, final String attrName)