Here you can find the source of getSibling(Node current)
Parameter | Description |
---|---|
current | a parameter |
public static Node getSibling(Node current)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Node; public class Main { /**//from w w w. j a v a 2 s. co m * 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; } }