Friday 5 August 2011

Get the next sibling element

  
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class Utils {
  /**
   * Get the next sibling element
   @param el
   @return
   */
  public static Element getNextSiblingElement(Element el) {
      for (Node n = el.getNextSibling(); n != null; n = n.getNextSibling()) {
          if (instanceof Element) {
              return (Elementn;
          }
      }
      return null;
  }

}

   
    
  

No comments:

Post a Comment