Code example for Element

Methods: getAttribute, getAttributeNS

0
	 * @param attr The attribute to be read 
	 * @return The value from the given attribute 
	 * @throws ParsingException Indicates the value in the attribute was not a float 
	 */ 
	static float getFloatAttribute(Element element, String attr) throws ParsingException {
		String cx = element.getAttribute(attr);
		if ((cx == null) || (cx.equals(""))) {
			cx = element.getAttributeNS(SODIPODI, attr);
		} 
		 
		try { 
			return Float.parseFloat(cx);
		} catch (NumberFormatException e) {
			throw new ParsingException(element, "Invalid value for: "+attr, e);
		} 
	} 
	 
	/** 
	 * Get the attribute value as a reference to another entity 
	 *  
	 * @param value The value to treat as reference