List of utility methods to do XML Attribute Get
int[] | getAttributeIntArray(final Node node, final String attribname) get Attribute Int Array final String attr = getAttributeValue(node, attribname); if (attr != null) { String[] splits = attr.split("[,\\s]"); int[] result = new int[splits.length]; for (int i = 0; i < splits.length; i++) { result[i] = Integer.valueOf(splits[i]); return result; ... |
Integer | getAttributeInteger(String filename, Element parent, String name) get Attribute Integer String attrStr = parent.getAttribute(name); if (attrStr == null) { return null; return textToInteger(filename, attrStr, name); |
Integer | getAttributeInteger(String filename, Element parent, String name) Gets the attribute integer. String attrStr = parent.getAttribute(name); if (attrStr == null) { return null; return textToInteger(filename, attrStr, name); |
int | getAttributeIntValue(Node n, String item, int dflt) Method getAttributeIntValue. final Node d = n.getAttributes().getNamedItem(item); if (d == null) { return dflt; final String val = d.getNodeValue(); if (val == null) { return dflt; return Integer.parseInt(val); |
String | getAttributeList(NamedNodeMap attributeMap) a concatenated list of the node's attributes. String attribs = ""; if (attributeMap != null) { attributeMap.getLength(); for (int i = 0; i < attributeMap.getLength(); i++) { Node n = attributeMap.item(i); attribs += n.getNodeName() + "=\"" + n.getNodeValue() + "\" "; return attribs; |
Map | getAttributeMap(final Node node) Returns a map of the passed node's attributes if (node == null) throw new IllegalArgumentException("The passed node was null"); final NamedNodeMap nnm = node.getAttributes(); final int size = nnm.getLength(); if (size == 0) return Collections.emptyMap(); final Map<String, String> map = new LinkedHashMap<String, String>(size); for (int i = 0; i < size; i++) { ... |
Map | getAttributeMap(NamedNodeMap nodeMap) Change NamedNodeMap type to Map type if (nodeMap != null) { int len = nodeMap.getLength(); HashMap map = new HashMap(); for (int i = 0; i < len; i++) { Node node = nodeMap.item(i); String name = node.getNodeName(); String value = node.getNodeValue(); if (name != null && !name.trim().equalsIgnoreCase("") && value != null) ... |
Map | getAttributeMap(XMLEvent evt) get Attribute Map Map<String, String> ret = new HashMap<String, String>(); if (evt.isStartElement()) { StartElement start = evt.asStartElement(); Iterator<Attribute> iterator = start.getAttributes(); while (iterator.hasNext()) { Attribute a = iterator.next(); ret.put(a.getName().getLocalPart(), a.getValue()); return ret; |
HashMap | getAttributeMap(XMLStreamReader xmlStreamReader) get Attribute Map HashMap<String, String> attributeMap = new HashMap<String, String>(); int attributeCount = xmlStreamReader.getAttributeCount(); for (int i = 0; i < attributeCount; i++) { String attributeName = xmlStreamReader.getAttributeName(i).getLocalPart(); String attributeValue = xmlStreamReader.getAttributeValue(i); attributeMap.put(attributeName, attributeValue); return attributeMap; ... |
String | getAttributeName(Field field) get Attribute Name XmlAttribute attribute = (XmlAttribute) field.getAnnotation(XmlAttribute.class); return !DEFAULT_NAME.equals(attribute.name()) ? attribute.name() : field.getName(); |