Code example for NodeList

Methods: getLength, item

0
		 
		NodeList nl = root.getElementsByTagName(tag);
		 
		XmlDom result = null;
		 
		if(nl != null && nl.getLength() > 0){
			result = new XmlDom((Element) nl.item(0));
		} 
		 
		 
		return result;
	} 
	 
	/** 
	 * Return a node that represents the first matched tag. 
	 * 
	 * If value == null, node that has the attr are considered a match. 
	 * 
	 * A dummy node is returned if none found. 
	 * 
	 * @param tag tag name