Here you can find the source of xmlGetAttribute(Node node, String attrname)
Parameter | Description |
---|---|
node | The Node to read the attribute from. |
attrname | The name of the attribute to read. |
public static String xmlGetAttribute(Node node, String attrname)
//package com.java2s; //License from project: Apache License import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; public class Main { /**// ww w. jav a 2 s. c o m * Reads an attribut from a DOM Node. * * @param node * The Node to read the attribute from. * @param attrname * The name of the attribute to read. */ public static String xmlGetAttribute(Node node, String attrname) { String theValue = null; if (node == null) return null; NamedNodeMap attrs = node.getAttributes(); if (attrs != null) { Node attr = attrs.getNamedItem(attrname); if (attr != null) { return attr.getNodeValue(); } } return theValue; } }