Here you can find the source of getNodeAttribute(Node n, String as)
n
named by attname
or "" if that attribute doesn't exist.
Parameter | Description |
---|---|
n | Node to query |
as | String naming the attribute |
public static String getNodeAttribute(Node n, String as) throws Exception
//package com.java2s; import org.w3c.dom.Node; import org.w3c.dom.Element; public class Main { /** Returns the String that is the attribute of Node <CODE>n</CODE> named by <CODE>attname</CODE> or "" if that attribute doesn't exist. Throws an Exception if <CODE>n</CODE> isn't an Element. //from w w w. j a v a 2 s .co m @param n Node to query @param as String naming the attribute */ public static String getNodeAttribute(Node n, String as) throws Exception { return ((Element) n).getAttribute(as); } }