Java XML Attribute Get getAttributeValueAsString(Node node)

Here you can find the source of getAttributeValueAsString(Node node)

Description

Gets the attribute value as string.

License

Open Source License

Parameter

Parameter Description
node the node from which to get the attribute value

Return

The attribute value as a string

Declaration

public final static String getAttributeValueAsString(Node node) throws DOMException 

Method Source Code

//package com.java2s;
/**/*  w w  w. j av a2 s  .  c  o m*/
 * Copyright (c) 1999-2007, Fiorano Software Technologies Pvt. Ltd. and affiliates.
 * Copyright (c) 2008-2015, Fiorano Software Pte. Ltd. and affiliates.
 *
 * All rights reserved.
 *
 * This software is the confidential and proprietary information
 * of Fiorano Software ("Confidential Information").  You
 * shall not disclose such Confidential Information and shall use
 * it only in accordance with the terms of the license agreement
 * enclosed with this product or entered into with Fiorano.
 */

import org.w3c.dom.*;

public class Main {
    /**
     *  Gets the attribute value as string.
     *
     *@param  node              the node from which to get the attribute value
     *@return                   The attribute value as a string
     *@exception  DOMException  if an error occurs while getting the attrubute
     *      value
     */
    public final static String getAttributeValueAsString(Node node) throws DOMException {
        if (node != null) {
            return node.getNodeValue();
        }
        return null;
    }
}

Related

  1. getAttributeValueAsBoolean(Attr attribute)
  2. getAttributeValueAsBoolean(Element el, String attrName)
  3. getAttributeValueAsDouble(Node node, String attributeName)
  4. getAttributeValueAsInteger(Node node, String attributeName, Integer defaultValue)
  5. getAttributeValueAsLong(final Element el, final String attrName, final long defaultVal)
  6. getAttributeValueBoolean(Node node, String attrName)
  7. getAttributeValueByName(NamedNodeMap nnm, String name)
  8. getAttributeValueByName(NamedNodeMap nnm, String name)
  9. getAttributeValueByName(Node node, String name)