Here you can find the source of getNextElementNode(Node node)
private static Node getNextElementNode(Node node)
//package com.java2s; /******************************************************************************* * Copyright (c) 2001, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * //from ww w. j a va 2s . c o m * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.Text; public class Main { private static Node getNextElementNode(Node node) { Node next = node.getNextSibling(); while (!(next instanceof Element) && next != null) { next = next.getNextSibling(); } if (next instanceof Text) { return null; } return next; } }