Example usage for org.dom4j.dom DOMNodeHelper getPreviousSibling

List of usage examples for org.dom4j.dom DOMNodeHelper getPreviousSibling

Introduction

In this page you can find the example usage for org.dom4j.dom DOMNodeHelper getPreviousSibling.

Prototype

public static org.w3c.dom.Node getPreviousSibling(Node node) 

Source Link

Usage

From source file:org.nuxeo.automation.scripting.blockly.converter.BlockHelper.java

License:Open Source License

public static Element getPreviousBlock(Element block) {

    if (!"block".equals(block.getName()) && !"placeHolder".equals(block.getName())) {
        throw new UnsupportedOperationException(block.getName() + " is not a block!");
    }//from   w  w w  . j  a v  a  2 s  .co m

    Element parentBlock = block.getParent();
    if ("next".equals(parentBlock.getName())) {
        return parentBlock.getParent();
    }

    return (Element) DOMNodeHelper.getPreviousSibling(block);
}