Java XML Element Sibling getPrevSibling(Element e)

Here you can find the source of getPrevSibling(Element e)

Description

get Prev Sibling

License

Open Source License

Declaration

public static Element getPrevSibling(Element e) 

Method Source Code

//package com.java2s;

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

public class Main {
    public static Element getPrevSibling(Element e) {
        Node n = e.getPreviousSibling();
        while (n != null && n.getNodeType() != Node.ELEMENT_NODE)
            n = n.getPreviousSibling();//  w  ww .j av  a  2  s  . c o  m
        return (Element) n;
    }
}

Related

  1. getNextSiblingElementByTagName(Element e, String name)
  2. getNextSiblingElementWithName(Element elem, String name)
  3. getPrecedingSiblings(Element element, String namespaceUri)
  4. getPreviousSiblingElement(Element elem)
  5. getPreviousSiblingElementByTagName(Element e, String name)
  6. getPrevSibling(Element element)
  7. getSiblingElement(Element e, String name)
  8. getSiblingNamed(Element element, String name)