List of utility methods to do XML Attribute Get
boolean | getAttributeAsBoolean(Element element, String attrName, boolean defValue) get Attribute As Boolean String value = element.getAttribute(attrName); try { if ((value != null) && (value.length() > 0)) { return Boolean.valueOf(value).booleanValue(); } catch (Exception ex) { return defValue; ... |
boolean | getAttributeAsBoolean(Element element, String attrName, boolean defValue) Get the value of the given attribute of this Element as a boolean value. String value = element.getAttribute(attrName); try { if ((value != null) && (value.length() > 0)) { return Boolean.valueOf(value).booleanValue(); } catch (Exception ex) { return defValue; ... |
boolean | getAttributeAsBoolean(Element element, String name) get Attribute As Boolean String value = element.getAttribute(name); if (value == null) { return false; return Boolean.parseBoolean(value); |
boolean | getAttributeAsBoolean(NamedNodeMap map, String name) Get a named value from the NamedNodeMap as a boolean. boolean value = false; try { value = (getAttribute(map, name)).equals("1"); } catch (Exception e) { return value; |
Integer | getAttributeAsInteger(Element element, String attrName, Integer defValue) get Attribute As Integer try { return Integer.valueOf(element.getAttribute(attrName)); } catch (Exception ex) { return defValue; |
Long | getAttributeAsLong(Element element, String attrName, Long defValue) Get the value of the given attribute of this Element as a java.lang.Long value. try { return Long.valueOf(element.getAttribute(attrName)); } catch (Exception ex) { return defValue; |
String | getAttributeAsString(NamedNodeMap attributes, String name) Get an attribute's value and return an empty string, of the attribute is not specified Attr attribute; String value = ""; attribute = (Attr) attributes.getNamedItem(name); if (attribute != null) { value = attribute.getValue(); return value; |
String | getAttributeAsString(XMLStreamReader reader, String name) Returns the string value of an attribute. return reader.getAttributeValue(null, name);
|
String | getAttributeAsURIString(XMLStreamReader reader, String name) TUSCANY-242 Returns the URI value of an attribute as a string and first applies the URI whitespace processing as defined in section 4.3.6 of XML Schema Part2: Datatypes [http://www.w3.org/TR/xmlschema-2/#rf-facets]. String uri = reader.getAttributeValue(null, name); if (uri != null) { uri = uri.replace('\t', ' '); uri = uri.replace('\n', ' '); uri = uri.replace('\r', ' '); uri = uri.trim(); StringBuilder sb = new StringBuilder(uri.length()); boolean spaceFound = false; ... |
boolean | getAttributeBoolean(Element aElement, String aAttributeName) Returns the boolean value of the specified attribute from the given Element.
return "true".equals(getAttribute(aElement, aAttributeName)); |