List of utility methods to do XML Attribute from Node
Date | getXMLDate(Element e, String attrName) get XML Date String s = e.getAttribute(attrName); if (s == null || s.length() == 0) return null; try { return parseDate(s); } catch (Exception exc) { return null; |
int | getXMLInt(Element e, String attrName) get XML Int try { return Integer.parseInt(e.getAttribute(attrName)); } catch (Exception exc) { return -1; |
int | getXMLInt(Element e, String attrName) get XML Int try { return Integer.parseInt(e.getAttribute(attrName)); } catch (Exception exc) { return -1; |
String | getXmlNodeAttribute(String attributeName, NodeList nodeList) Extract the node string representation. String retObj = null; if (nodeList != null && nodeList.getLength() > 0) { Element element = (Element) nodeList.item(0); retObj = element.getAttribute(attributeName); return retObj; |
String | getXmlNodeAttributeValue(Node NN, String AttrName) Returns the String value of the given attribue of an xml node if (NN == null) return null; if (AttrName == null) return null; if (AttrName.length() < 1) return null; NamedNodeMap atts = NN.getAttributes(); if (atts != null) { ... |
Boolean | getYesNoAttrVal(final NamedNodeMap nnm, final String name) The attribute value of the named attribute in the given map must be absent or "yes" or "no". String val = getAttrVal(nnm, name); if (val == null) { return null; if ((!"yes".equals(val)) && (!"no".equals(val))) { throw new SAXException("Invalid attribute value: " + val); return new Boolean("yes".equals(val)); ... |
boolean | hasAttribByName(Element node, String name) has Attrib By Name return node.hasAttribute(name);
|
String | parseAttribute(Node lnNode, String attributeName) parse Attribute NamedNodeMap attributes = lnNode.getAttributes(); String attributeValue = null; if (attributes != null) { Node attributeNode; for (int i = 0; i < attributes.getLength(); i++) { attributeNode = attributes.item(i); if (attributeNode.getNodeName().equals(attributeName)) attributeValue = attributeNode.getNodeValue(); ... |
Map | parseAttribute(NodeList abtList) parse Attribute Map map = new HashMap(); try { for (int i = 0; i < abtList.getLength(); i++) { Node abt = abtList.item(i); if (abt.getNodeType() == 1) { map.put(abt.getNodeName(), abt.getTextContent().replace("'", "").replace("?", "")); } catch (Exception e) { e.printStackTrace(); return map; |
Properties | parseAttributes(Node n) parse Attributes return parseAttributes(n, null);
|