List of usage examples for org.dom4j.dom DOMElement insertBefore
public org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild) throws DOMException
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); }