Package org.dom4j

Examples of org.dom4j.Element.indexOf()


    int j = 0;

    for (Iterator responses = el_labels.iterator(); responses.hasNext();) {
      Element response = (Element) responses.next();
      Element parent = response.getParent();
      int pos = parent.indexOf(response);
      posList[j++] = pos;
      respList.add(response.clone()); // need to use clones so they are not
      // attached anymore
      parentList.add(parent);
    }
View Full Code Here


        // The request parameters insertBefore and insertAfter
        // overwrite the configuration (insertImageBefore)
        if (insertBefore || (insertImageBefore && !insertAfter)) {
            // insert the tag before the imageXPath
            list.add(parent.indexOf(node), mediaTag);
        } else {
            // insert the tag after the imageXPath
            list.add(parent.indexOf(node) + 1, mediaTag);
        }
View Full Code Here

        if (insertBefore || (insertImageBefore && !insertAfter)) {
            // insert the tag before the imageXPath
            list.add(parent.indexOf(node), mediaTag);
        } else {
            // insert the tag after the imageXPath
            list.add(parent.indexOf(node) + 1, mediaTag);
        }

        // write it back to the file
        OutputStream out = new BufferedOutputStream(new FileOutputStream(requestingDocumentPath));
        OutputFormat outputFormat = new OutputFormat();
View Full Code Here

     * @param element element the newElement will be insert before this element
     * @param newElement element to insert
     */
    public void insertElementBefore(Element element, Element newElement) {
        Element parent = element.getParent();
        insertElementAt(element, newElement, parent.indexOf(element));
    }

    /**
     * insert the newElement after the element as child of the same node.
     *
 
View Full Code Here

     * @param element element the newElement will be insert after this element
     * @param newElement element to insert
     */
    public void insertElementAfter(Element element, Element newElement) {
        Element parent = element.getParent();
        insertElementAt(element, newElement, parent.indexOf(element) + 1);
    }
}
// DOM4JUtil
View Full Code Here

    public static org.w3c.dom.Node getPreviousSibling(Node node) {
        Element parent = node.getParent();

        if (parent != null) {
            int index = parent.indexOf(node);

            if (index > 0) {
                Node previous = parent.node(index - 1);

                return asDOMNode(previous);
View Full Code Here

    public static org.w3c.dom.Node getNextSibling(Node node) {
        Element parent = node.getParent();

        if (parent != null) {
            int index = parent.indexOf(node);

            if (index >= 0) {
                if (++index < parent.nodeCount()) {
                    Node next = parent.node(index);
View Full Code Here

    public static org.w3c.dom.Node getPreviousSibling(Node node) {
        Element parent = node.getParent();

        if (parent != null) {
            int index = parent.indexOf(node);

            if (index > 0) {
                Node previous = parent.node(index - 1);

                return asDOMNode(previous);
View Full Code Here

    public static org.w3c.dom.Node getNextSibling(Node node) {
        Element parent = node.getParent();

        if (parent != null) {
            int index = parent.indexOf(node);

            if (index >= 0) {
                if (++index < parent.nodeCount()) {
                    Node next = parent.node(index);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.