Here you can find the source of getAttributeAsLong(Element element, String attrName, Long defValue)
Parameter | Description |
---|---|
element | Element |
attrName | name of the attribute to parse |
defValue | Default Long value if a valid Long text not found. |
public static final Long getAttributeAsLong(Element element, String attrName, Long defValue)
//package com.java2s; import org.w3c.dom.Element; public class Main { /**//from w w w . j av a 2 s . c o m * Get the value of the given attribute of this Element as a java.lang.Long value. * * @param element * Element * @param attrName * name of the attribute to parse * @param defValue * Default Long value if a valid Long text not found. * * @return Returns the value of the attribute parsed as Long. Returns defValue if the given attribute is not found, * or its value is not a valid Long. */ public static final Long getAttributeAsLong(Element element, String attrName, Long defValue) { try { return Long.valueOf(element.getAttribute(attrName)); } catch (Exception ex) { } return defValue; } }