Java XML Last Child Element getLastChildElement(Node start)

Here you can find the source of getLastChildElement(Node start)

Description

__UNDOCUMENTED__

License

BSD License

Parameter

Parameter Description
start __UNDOCUMENTED__

Return

__UNDOCUMENTED__

Declaration

public static Element getLastChildElement(Node start) 

Method Source Code


//package com.java2s;
/*//from  w  ww  .j  ava  2s  .  co m
 * Copyright (c) 2012. betterFORM Project - http://www.betterform.de
 * Licensed under the terms of BSD License
 */

import org.w3c.dom.*;

public class Main {
    /**
     * __UNDOCUMENTED__
     *
     * @param start __UNDOCUMENTED__
     * @return __UNDOCUMENTED__
     */
    public static Element getLastChildElement(Node start) {
        NodeList children = start.getChildNodes();

        if (children != null) {
            int len = children.getLength();
            Node n = null;

            for (int i = len - 1; i >= 0; i--) {
                n = children.item(i);

                if (n.getNodeType() == Node.ELEMENT_NODE) {
                    return ((Element) n);
                }
            }
        }

        return null;
    }
}

Related

  1. getLastChildElement(Node node)
  2. getLastChildElement(Node node)
  3. getLastChildElement(Node node)
  4. getLastChildElement(Node parent)
  5. getLastChildElement(Node parent)
  6. getLastChildElementNS(Node parent, String uri, String localpart)
  7. getLastChildWithTagNameNS(Element parent, String namespaceURI, String localName)
  8. getLastNamedChildNode(Node root, String nodeName)
  9. getLastNodeChild(Node node)