Here you can find the source of getNodeAttribute(Node QueryNode, String AttrName)
Parameter | Description |
---|---|
QueryNode | non-null node |
AttrName | non-null attr name return possibly null value - null of the attribute does not exist |
public static String getNodeAttribute(Node QueryNode, String AttrName)
//package com.java2s; //License from project: Apache License import org.w3c.dom.*; public class Main { /**//from w w w . j av a 2 s . com * return an attruibte value from a Node * @param QueryNode non-null node * @param AttrName non-null attr name * return possibly null value - null of the attribute does not exist */ public static String getNodeAttribute(Node QueryNode, String AttrName) { NamedNodeMap attrs = QueryNode.getAttributes(); if (attrs == null) return (null); Node Value = attrs.getNamedItem(AttrName); if (Value == null) return (null); return (Value.getNodeValue()); } }