Example usage for org.dom4j.tree DefaultElement indexOf

List of usage examples for org.dom4j.tree DefaultElement indexOf

Introduction

In this page you can find the example usage for org.dom4j.tree DefaultElement indexOf.

Prototype

public int indexOf(Node node) 

Source Link

Usage

From source file:com.mor.blogengine.xml.XMLHandlerImpl.java

License:Open Source License

/**
 * Append a node to parent node/* w  w w .  jav  a  2 s .  co m*/
 *
 * @param root The node to add under
 * @param content what to add to root node
 * @return appended or not
 */
@Override
public boolean append(DefaultElement root, DefaultElement content) {
    String elemID = root.valueOf("@ID");
    DefaultElement elemInDoc = (DefaultElement) mRootElement.elementByID(elemID);

    if (elemInDoc != null) {
        elemInDoc.add(content);

        int indexOfappended = elemInDoc.indexOf(content);

        return (indexOfappended != -1);
    }
    return false;
}