All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.simy4.xpath.jdom.navigator.node.JDomNode Maven / Gradle / Ivy

There is a newer version: 2.3.9
Show newest version
package com.github.simy4.xpath.jdom.navigator.node;

import com.github.simy4.xpath.XmlBuilderException;
import com.github.simy4.xpath.navigator.Node;
import org.jdom2.Attribute;
import org.jdom2.Element;

/**
 * JDOM node contract.
 *
 * @author Alex Simkin
 * @since 2.1
 */
public interface JDomNode extends Node {

    /**
     * Retrieves the XML model root.
     *
     * @return XML root
     */
    JDomNode getRoot();

    /**
     * Retrieves the parent of this XML node.
     *
     * @return XML node parent
     */
    JDomNode getParent();

    /**
     * Retrieves all child element nodes of this node.
     *
     * @return child element nodes
     */
    Iterable elements();

    /**
     * Retrieves all attributes of this node.
     *
     * @return attributes
     */
    Iterable attributes();

    /**
     * Creates XML attribute node and appends to ths node.
     *
     * @param attribute new XML attribute's name
     * @return new attribute node
     * @throws XmlBuilderException if failure occur during XML attribute creation
     */
    JDomNode appendAttribute(Attribute attribute) throws XmlBuilderException;

    /**
     * Creates XML element node and appends to ths node.
     *
     * @param element new XML element's name
     * @return new element node
     * @throws XmlBuilderException if failure occur during XML element creation
     */
    JDomNode appendElement(Element element) throws XmlBuilderException;

    void prependCopy() throws XmlBuilderException;

    /**
     * Sets the given text content to this node.
     *
     * @param text text content to set
     * @throws XmlBuilderException if failure occur during setting the text content
     */
    void setText(String text) throws XmlBuilderException;

    /**
     * Detach this node from the DOM.
     *
     * @throws XmlBuilderException if failure occur during node detaching
     */
    void remove() throws XmlBuilderException;

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy