Example usage for org.dom4j.dom DOMElement insertBefore

List of usage examples for org.dom4j.dom DOMElement insertBefore

Introduction

In this page you can find the example usage for org.dom4j.dom DOMElement insertBefore.

Prototype

public org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild) throws DOMException 

Source Link

Usage

From source file:hello.SampleSimpleApplication.java

License:Apache License

private void addBreadcrumbBefore(DOMElement autoTileElement) {
    DOMDocument document = (DOMDocument) autoTileElement.getDocument();
    DOMElement breadcrumbEl = (DOMElement) document.createElement("div");
    //      breadcrumbEl.addAttribute("style", "font-weight: bold; left: 0px; position: absolute; top: 3px; font-size:x-small;");
    breadcrumbEl.addAttribute("style", "left: 0px; position: absolute; top: 3px; font-size:x-small;");
    Element lastChildElement = (Element) bookmarks.selectSingleNode("*[last()]");
    addBreadcrumbItem(lastChildElement, breadcrumbEl);
    DOMElement h4El = (DOMElement) autoTileElement.selectSingleNode("*");//.detach();
    autoTileElement.insertBefore(breadcrumbEl, h4El);
}