Java XML Attribute Get getAttributeValue(Node node, String attribute)

Here you can find the source of getAttributeValue(Node node, String attribute)

Description

get Attribute Value

License

Open Source License

Declaration

public static String getAttributeValue(Node node, String attribute) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2012 Pivotal Software, Inc.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors://ww  w .j  a  va2s  .co  m
 *     Pivotal Software, Inc. - initial API and implementation
 *******************************************************************************/

import org.w3c.dom.Node;

public class Main {
    public static String getAttributeValue(Node node, String attribute) {
        Node item = node.getAttributes().getNamedItem(attribute);
        return (item != null) ? item.getNodeValue() : null;
    }
}

Related

  1. getAttributeValue(Node n, String nodePath, String attrName)
  2. getAttributeValue(Node node, String attName)
  3. getAttributeValue(Node node, String attName)
  4. getAttributeValue(Node node, String attribute)
  5. getAttributeValue(Node node, String attribute)
  6. getAttributeValue(Node node, String attributeName)
  7. getAttributeValue(Node node, String attributeName)
  8. getAttributeValue(Node node, String attributeName)
  9. getAttributeValue(Node node, String attributeName)