Java XML Node Sibiling getNextNodeSibling(Node node)

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

Description

Get the next non-text sibling after a node.

License

Open Source License

Parameter

Parameter Description
node org.w3c.dom.Node The node

Return

org.w3c.dom.Node The first non-text sibling node after If there is no next non-text sibling, null is returned.

Declaration

public static Node getNextNodeSibling(Node node) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2003, 2006 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
 *
 * Contributors:/*from  ww  w  . ja va  2  s  .  c  o m*/
 * IBM Corporation - initial API and implementation
 *******************************************************************************/

import org.w3c.dom.Node;

public class Main {
    /**
     * Get the next non-text sibling after a node.
     * 
     * @return org.w3c.dom.Node The first non-text sibling node after
     * @node. If there is no next non-text sibling, null is returned.
     * @param node
     *            org.w3c.dom.Node The node
     */
    public static Node getNextNodeSibling(Node node) {
        Node sibling = node.getNextSibling();
        while (sibling != null
                && sibling.getNodeType() != Node.ELEMENT_NODE)
            sibling = sibling.getNextSibling();
        return sibling;
    }
}

Related

  1. getNextElementSibling(Node node)
  2. getNextElementSibling(Node node)
  3. getNextElementSibling(Node node)
  4. getNextHomoSibling(Node aNode)
  5. getNextNamedSibling(Node node, String nodeName)
  6. getNextSibling(Node node)
  7. getNextSiblingElement(Node n)
  8. getNextSiblingElement(Node n, String ns, String localName)
  9. getNextSiblingElement(Node node)