Code example for Element

Methods: getAttributegetAttributeNS

	 * @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 
Experience pair programming with AI  Get Codota for Java