Code example for Node

Methods: getAttributes

0
	 * @param element - element to retrieve the attribute from. 
	 * @param attr - attribute to get value. 
	 * @return attribute value or {@code null} 
	 */ 
	public static String determineAttributeValue(Node element, String attr) {
		NamedNodeMap attributes = element.getAttributes();
		return attributes!=null ? determineNodeValue(attributes.getNamedItem(attr)) : null;
	} 
 
	/** 
	 * The method creates an element with specified name and attributes and appends it to the parent element. 
	 * This is a convenience method for often used sequence of calls. 
	 * 
	 * @param parent - the node where to append the new element. 
	 * @param name - the name of the element type being created. 
	 * @param attributes - string array of pairs attributes and their values. 
	 *     Each attribute must have a value, so the array must have even number of elements. 
	 * @return the newly created element. 
	 * 
	 * @throws ArrayIndexOutOfBoundsException in case of odd number of elements of the attribute array