Here you can find the source of getNextElementSibling(Element aElement)
Parameter | Description |
---|---|
aElement | Element to start scan for the next Element. |
null
otherwise.
public static Element getNextElementSibling(Element aElement)
//package com.java2s; /*********************************************************** Copyright (C) 2004 VeriSign, Inc.//from w w w. j a v a2s.com This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA http://www.verisign.com/nds/naming/namestore/techdocs.html ***********************************************************/ import org.w3c.dom.*; public class Main { /** * Gets the next sibling Element of a provided Element. * * @param aElement * Element to start scan for the next Element. * @return Found DOM Element Node if found; <code>null</code> otherwise. */ public static Element getNextElementSibling(Element aElement) { Element theSibling = null; Node theCurrNode = aElement; while ((theCurrNode != null) && (theSibling == null)) { theCurrNode = theCurrNode.getNextSibling(); if ((theCurrNode != null) && (theCurrNode.getNodeType() == Node.ELEMENT_NODE)) { theSibling = (Element) theCurrNode; } } return theSibling; } }