List of utility methods to do XML Element Get
List | getElementList(Element element) get Element List if (element == null) { return Collections.emptyList(); NodeList childNodes = element.getChildNodes(); int numChildren = childNodes.getLength(); List<Element> elementList = new ArrayList<Element>(numChildren); for (int i = 0; i < numChildren; i++) { Node childNode = childNodes.item(i); ... |
NodeList | getElementList(Element element, String name) Return a list of named Elements. return element.getElementsByTagName(name);
|
List | getElementList(final Element element) Obtains the list of child element nodes. final List<Element> elementList = new ArrayList<Element>(); final NodeList childNodes = element.getChildNodes(); final int numChildren = childNodes.getLength(); for (int i = 0; i < numChildren; i++) { final Node childNode = childNodes.item(i); if (childNode.getNodeType() != Node.ELEMENT_NODE) { continue; elementList.add((Element) childNode); return elementList; |
String | getElementLocalName(Element element) get Element Local Name String localName = null; if (element == null) { throw new IllegalArgumentException("The element cannot be null"); } else { try { localName = element.getLocalName(); } catch (NoSuchMethodError e) { localName = element.getTagName(); ... |
String | getElementName(Class> claz) Returns the element name of the specified class. try { XmlType annotation = claz.getAnnotation(XmlType.class); if (annotation.name() != null) { return annotation.name(); } catch (Exception e) { return claz.getSimpleName(); ... |
String | getElementName(Class> clazz) get Element Name while (clazz != null) { XmlRootElement rootElement = clazz.getAnnotation(XmlRootElement.class); if (rootElement != null) { return rootElement.name(); clazz = clazz.getSuperclass(); throw new RuntimeException(); ... |
String | getElementName(Element element) Returns the element name of the given element. String elemName = element.getLocalName(); if (elemName == null) { elemName = element.getNodeName(); return elemName; |
String | getElementName(Element element) Get the name of the element return element.getNodeName();
|
String | getElementName(Element element) Returns the name of the element. if (element.getPrefix() != null && element.getPrefix().length() > 0) { return element.getPrefix() + ':' + element.getLocalName(); } else { return element.getLocalName(); |
String | getElementName(Field field) get Element Name XmlElement element = (XmlElement) field.getAnnotation(XmlElement.class); return !DEFAULT_NAME.equals(element.name()) ? element.name() : field.getName(); |