The list of methods to do XML Element Find are organized into topic(s).
Element
findComponentElement(Element root) find Component Element
if (root == null) {
return null;
NodeList children = root.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
Node child = children.item(i);
if (child.getNodeType() == Node.ELEMENT_NODE) {
Element trimmedElement = findComponentElement((Element) child);
...
Element
findComponentElement(Element root) find Component Element
if (root == null) {
return null;
NodeList children = root.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
Node child = children.item(i);
if (child.getNodeType() == Node.ELEMENT_NODE) {
Element trimmedElement = findComponentElement((Element) child);
...
Element
findElement(Element element, String elementName) If there is no such element, one will be created on element .
NodeList elements = element.getElementsByTagName(elementName);
if ((elements == null) || (elements.getLength() == 0)) {
return createElement(element, elementName);
return (Element) elements.item(0);
Element
findElement(Element element, String name) find Element
NodeList list = element.getChildNodes();
for (int i = 0; i < list.getLength(); i++) {
Node child = (Node) list.item(i);
if (child instanceof Element) {
Element childEl = (Element) child;
if (name.equals(childEl.getLocalName())) {
return childEl;
} else {
...
Element
findElement(Element topElm, String localName, String namespace) Find element.
Stack<Element> stack = new Stack<Element>();
stack.push(topElm);
while (!stack.isEmpty()) {
Element curElm = stack.pop();
if ((curElm.getLocalName().equals(localName))
&& (namespacesAreSame(curElm.getNamespaceURI(), namespace))) {
return curElm;
NodeList childNodes = curElm.getChildNodes();
for (int i = 0, ll = childNodes.getLength(); i < ll; i++) {
Node item = childNodes.item(i);
if (item.getNodeType() == Node.ELEMENT_NODE) {
stack.push((Element) item);
return null;
Element
findElement(final Element e, final String find) Find a child element.
for (Node child = e.getFirstChild(); child != null; child = child.getNextSibling()) {
if (!(child instanceof Element)) {
continue;
final Element el = (Element) child;
if (el.getNodeName().equals(find)) {
return el;
return null;
Element
findElement(final String idValue, final String idTagName, final String tagName, final Element root) find element with tagName whose id tag is 'idTagName' and id value is 'id_value'
String textVal = null;
final NodeList nl = root.getElementsByTagName(tagName);
if (nl != null && nl.getLength() > 0) {
for (int i = 0; i < nl.getLength(); i++) {
final Element ei = (Element) nl.item(i);
final NodeList n2 = ei.getElementsByTagName(idTagName);
if (n2 != null && n2.getLength() > 0) {
for (int j = 0; j < n2.getLength(); j++) {
...