Java XML Node Next getNextElementNode(Node node)

Here you can find the source of getNextElementNode(Node node)

Description

get Next Element Node

License

Open Source License

Declaration

private static Node getNextElementNode(Node node) 

Method Source Code

//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;
    }
}

Related

  1. getNextElement(Node el)
  2. getNextElement(Node node)
  3. getNextElement(Node node)
  4. getNextElement(Node node)
  5. getNextElementNode(Node node)
  6. getNextNode(Node current)
  7. getNextNodeByName(Node currentNode, String tagName)
  8. getNextTypedNode(Node node, short nodeType)
  9. getNextTypedNode(Node node, short nodeType)