Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import org.w3c.dom.Node;

public class Main {
    /**
     * Get the sibling in next context
     * 
     * @param current
     * @return the sibling
     */
    public static Node getSibling(Node current) {
        Node sibling = current.getNextSibling();
        Node tmpParent = current;
        while (tmpParent != null && sibling == null) {
            tmpParent = tmpParent.getParentNode();
            if (tmpParent != null) {
                sibling = tmpParent.getNextSibling();
            }
        }
        return sibling;
    }
}