List of utility methods to do XML Attribute from Node
void | generateIds(Node root, String attrName) adds an attribute with random value to all elements, that do not have an attribute with the specified name. if (root.getNodeType() == Node.ELEMENT_NODE) { Element e = (Element) root; String id = e.getAttribute(attrName); if (id == null || id.length() == 0) e.setAttribute(attrName, randomId()); NodeList list = root.getChildNodes(); int N = list.getLength(); ... |
Vector | getALLAttribute(final Node iNode) get ALL Attribute Vector<Attr> result = new Vector<Attr>(); if (iNode != null) { NamedNodeMap attrList = iNode.getAttributes(); int numAttr = attrList.getLength(); Attr currentAttrNode = null; for (int k = 0; k < numAttr; k++) { currentAttrNode = (Attr) attrList.item(k); result.add(currentAttrNode); ... |
float | getFloatAttribute(Node node, String name, float defVal) get Float Attribute String att = getAttribute(node, name); if (att == null) return defVal; return Float.parseFloat(att); |
float | getFloatAttribute(Node node, String name, float defVal) get Float Attribute String att = getAttribute(node, name); if (att == null) return defVal; return Float.parseFloat(att); |
int | getIntAttr(Node node, String attrName) get Int Attr String sValue = getAttr(node, attrName); if (sValue == null) { return Integer.MIN_VALUE; return Integer.parseInt(sValue); |
int | getIntAttribute(Node n, String s) get Int Attribute return Integer.parseInt(getAttribute(n, s));
|
int | getIntAttribute(Node node, String attr) get Int Attribute return getIntAttribute(node, attr, 0);
|
int | getIntAttribute(Node node, String attributeName, int defaultValue) get Int Attribute String value = getAttribute(node, attributeName); if (value == null) { return defaultValue; return Integer.parseInt(value); |
int | getIntAttribute(Node node, String name, int defVal) get Int Attribute String att = getAttribute(node, name); if (att == null) return defVal; return Integer.parseInt(att); |
int | getIntAttributeRequired(Node node, String attributeName) get Int Attribute Required String string = getStringAttributeRequired(node, attributeName); try { return Integer.parseInt(string); } catch (Exception e) { throw new Exception("Could not read integer from value '" + string + "' in attribute '" + attributeName + "' in node '" + node.getLocalName() + "'"); |