Java Code Examples for org.w3c.dom.Node#DOCUMENT_POSITION_CONTAINED_BY

The following examples show how to use org.w3c.dom.Node#DOCUMENT_POSITION_CONTAINED_BY . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DOMResult.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * <p>Set the node that will contain the result DOM tree.<p>
 *
 * <p>In practice, the node should be
 * a {@link org.w3c.dom.Document} node,
 * a {@link org.w3c.dom.DocumentFragment} node, or
 * a {@link org.w3c.dom.Element} node.
 * In other words, a node that accepts children.</p>
 *
 * <p>An <code>IllegalStateException</code> is thrown if
 * <code>nextSibling</code> is not <code>null</code> and
 * <code>node</code> is not a parent of <code>nextSibling</code>.
 * An <code>IllegalStateException</code> is thrown if <code>node</code> is <code>null</code> and
 * <code>nextSibling</code> is not <code>null</code>.</p>
 *
 * @param node The node to which the transformation will be appended.
 *
 * @throws IllegalStateException If <code>nextSibling</code> is not
 *   <code>null</code> and
 *   <code>nextSibling</code> is not a child of <code>node</code> or
 *   <code>node</code> is <code>null</code> and
 *   <code>nextSibling</code> is not <code>null</code>.
 */
public void setNode(Node node) {
    // does the corrent parent/child relationship exist?
    if (nextSibling != null) {
        // cannot be a sibling of a null node
        if (node == null) {
            throw new IllegalStateException("Cannot create a DOMResult when the nextSibling is contained by the \"null\" node.");
        }

        // nextSibling contained by node?
        if ((node.compareDocumentPosition(nextSibling)&Node.DOCUMENT_POSITION_CONTAINED_BY)==0) {
            throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is not contained by the node.");
        }
    }

    this.node = node;
}
 
Example 2
Source File: DOMResult.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * <p>Use a DOM node to create a new output target specifying the child node where the result nodes should be inserted before and
 * the specified System ID.</p>
 *
 * <p>In practice, <code>node</code> and <code>nextSibling</code> should be
 * a {@link org.w3c.dom.Document} node,
 * a {@link org.w3c.dom.DocumentFragment} node, or a
 * {@link org.w3c.dom.Element} node.
 * In other words, a node that accepts children.</p>
 *
 * <p>Use <code>nextSibling</code> to specify the child node
 * where the result nodes should be inserted before.
 * If <code>nextSibling</code> is not a sibling of <code>node</code>,
 * then an <code>IllegalArgumentException</code> is thrown.
 * If <code>node</code> is <code>null</code> and <code>nextSibling</code> is not <code>null</code>,
 * then an <code>IllegalArgumentException</code> is thrown.
 * If <code>nextSibling</code> is <code>null</code>,
 * then the behavior is the same as calling {@link #DOMResult(Node node, String systemId)},
 * i.e. append the result nodes as the last child of the specified node and use the specified System ID.</p>
 *
 * @param node The DOM node that will contain the result tree.
 * @param nextSibling The child node where the result nodes should be inserted before.
 * @param systemId The system identifier which may be used in association with this node.
 *
 * @throws IllegalArgumentException If <code>nextSibling</code> is not a
 *   sibling of <code>node</code> or
 *   <code>node</code> is <code>null</code> and <code>nextSibling</code>
 *   is not <code>null</code>.
 *
 * @since 1.5
 */
public DOMResult(Node node, Node nextSibling, String systemId) {

    // does the corrent parent/child relationship exist?
    if (nextSibling != null) {
        // cannot be a sibling of a null node
        if (node == null) {
            throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is contained by the \"null\" node.");
        }

        // nextSibling contained by node?
        if ((node.compareDocumentPosition(nextSibling)&Node.DOCUMENT_POSITION_CONTAINED_BY)==0) {
            throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is not contained by the node.");
        }
    }

    setNode(node);
    setNextSibling(nextSibling);
    setSystemId(systemId);
}
 
Example 3
Source File: DOMResult.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * <p>Set the node that will contain the result DOM tree.<p>
 *
 * <p>In practice, the node should be
 * a {@link org.w3c.dom.Document} node,
 * a {@link org.w3c.dom.DocumentFragment} node, or
 * a {@link org.w3c.dom.Element} node.
 * In other words, a node that accepts children.</p>
 *
 * <p>An <code>IllegalStateException</code> is thrown if
 * <code>nextSibling</code> is not <code>null</code> and
 * <code>node</code> is not a parent of <code>nextSibling</code>.
 * An <code>IllegalStateException</code> is thrown if <code>node</code> is <code>null</code> and
 * <code>nextSibling</code> is not <code>null</code>.</p>
 *
 * @param node The node to which the transformation will be appended.
 *
 * @throws IllegalStateException If <code>nextSibling</code> is not
 *   <code>null</code> and
 *   <code>nextSibling</code> is not a child of <code>node</code> or
 *   <code>node</code> is <code>null</code> and
 *   <code>nextSibling</code> is not <code>null</code>.
 */
public void setNode(Node node) {
    // does the corrent parent/child relationship exist?
    if (nextSibling != null) {
        // cannot be a sibling of a null node
        if (node == null) {
            throw new IllegalStateException("Cannot create a DOMResult when the nextSibling is contained by the \"null\" node.");
        }

        // nextSibling contained by node?
        if ((node.compareDocumentPosition(nextSibling)&Node.DOCUMENT_POSITION_CONTAINED_BY)==0) {
            throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is not contained by the node.");
        }
    }

    this.node = node;
}
 
Example 4
Source File: DOMResult.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * Use a DOM node to create a new output target specifying
 * the child node where the result nodes should be inserted before.
 *
 * <p>In practice, {@code node} and {@code nextSibling} should be
 * a {@link org.w3c.dom.Document} node,
 * a {@link org.w3c.dom.DocumentFragment} node, or
 * a {@link org.w3c.dom.Element} node.
 * In other words, a node that accepts children.
 *
 * <p>Use {@code nextSibling} to specify the child node
 * where the result nodes should be inserted before.
 * If {@code nextSibling} is not a sibling of {@code node},
 * then an {@code IllegalArgumentException} is thrown.
 * If {@code node} is {@code null} and {@code nextSibling} is not {@code null},
 * then an {@code IllegalArgumentException} is thrown.
 * If {@code nextSibling} is {@code null},
 * then the behavior is the same as calling {@link #DOMResult(Node node)},
 * i.e. append the result nodes as the last child of the specified {@code node}.
 *
 * <p>{@code systemId} will be set to {@code null}.
 *
 * @param node The DOM node that will contain the result tree.
 * @param nextSibling The child node where the result nodes should be inserted before.
 *
 * @throws IllegalArgumentException If {@code nextSibling} is not a sibling of {@code node} or
 *   {@code node} is {@code null} and {@code nextSibling}
 *   is not {@code null}.
 *
 * @since 1.5
 */
public DOMResult(Node node, Node nextSibling) {

    // does the corrent parent/child relationship exist?
    if (nextSibling != null) {
        // cannot be a sibling of a null node
        if (node == null) {
            throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is contained by the \"null\" node.");
        }

        // nextSibling contained by node?
        if ((node.compareDocumentPosition(nextSibling)&Node.DOCUMENT_POSITION_CONTAINED_BY)==0) {
            throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is not contained by the node.");
        }
    }

    setNode(node);
    setNextSibling(nextSibling);
    setSystemId(null);
}
 
Example 5
Source File: DOMResult.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * <p>Use a DOM node to create a new output target specifying the child node where the result nodes should be inserted before.</p>
 *
 * <p>In practice, <code>node</code> and <code>nextSibling</code> should be
 * a {@link org.w3c.dom.Document} node,
 * a {@link org.w3c.dom.DocumentFragment} node, or
 * a {@link org.w3c.dom.Element} node.
 * In other words, a node that accepts children.</p>
 *
 * <p>Use <code>nextSibling</code> to specify the child node
 * where the result nodes should be inserted before.
 * If <code>nextSibling</code> is not a sibling of <code>node</code>,
 * then an <code>IllegalArgumentException</code> is thrown.
 * If <code>node</code> is <code>null</code> and <code>nextSibling</code> is not <code>null</code>,
 * then an <code>IllegalArgumentException</code> is thrown.
 * If <code>nextSibling</code> is <code>null</code>,
 * then the behavior is the same as calling {@link #DOMResult(Node node)},
 * i.e. append the result nodes as the last child of the specified <code>node</code>.</p>
 *
 * <p><code>systemId</code> will be set to <code>null</code>.</p>
 *
 * @param node The DOM node that will contain the result tree.
 * @param nextSibling The child node where the result nodes should be inserted before.
 *
 * @throws IllegalArgumentException If <code>nextSibling</code> is not a sibling of <code>node</code> or
 *   <code>node</code> is <code>null</code> and <code>nextSibling</code>
 *   is not <code>null</code>.
 *
 * @since 1.5
 */
public DOMResult(Node node, Node nextSibling) {

    // does the corrent parent/child relationship exist?
    if (nextSibling != null) {
        // cannot be a sibling of a null node
        if (node == null) {
            throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is contained by the \"null\" node.");
        }

        // nextSibling contained by node?
        if ((node.compareDocumentPosition(nextSibling)&Node.DOCUMENT_POSITION_CONTAINED_BY)==0) {
            throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is not contained by the node.");
        }
    }

    setNode(node);
    setNextSibling(nextSibling);
    setSystemId(null);
}
 
Example 6
Source File: DOMResult.java    From j2objc with Apache License 2.0 4 votes vote down vote up
/**
 * <p>Set the node that will contain the result DOM tree.<p>
 *
 * <p>In practice, the node should be
 * a {@link org.w3c.dom.Document} node,
 * a {@link org.w3c.dom.DocumentFragment} node, or
 * a {@link org.w3c.dom.Element} node.
 * In other words, a node that accepts children.</p>
 *
 * <p>An <code>IllegalStateException</code> is thrown if <code>nextSibling</code> is not <code>null</code> and
 * <code>node</code> is not a parent of <code>nextSibling</code>.
 * An <code>IllegalStateException</code> is thrown if <code>node</code> is <code>null</code> and
 * <code>nextSibling</code> is not <code>null</code>.</p>
 *
 * @param node The node to which the transformation will be appended.
 *
 * @throws IllegalStateException If <code>nextSibling</code> is not <code>null</code> and
 *   <code>nextSibling</code> is not a child of <code>node</code>.
 * @throws IllegalStateException If <code>node</code> is <code>null</code> and
 *   <code>nextSibling</code> is not <code>null</code>.
 */
public void setNode(Node node) {
    // does the corrent parent/child relationship exist?
    if (nextSibling != null) {
        // cannot be a sibling of a null node
        if (node == null) {
            throw new IllegalStateException("Cannot create a DOMResult when the nextSibling is contained by the \"null\" node.");
        }

        // nextSibling contained by node?
        if ((node.compareDocumentPosition(nextSibling)&Node.DOCUMENT_POSITION_CONTAINED_BY)==0) {
            throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is not contained by the node.");
        }
    }

    this.node = node;
}
 
Example 7
Source File: DOMResult.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * <p>Set the node that will contain the result DOM tree.<p>
 *
 * <p>In practice, the node should be
 * a {@link org.w3c.dom.Document} node,
 * a {@link org.w3c.dom.DocumentFragment} node, or
 * a {@link org.w3c.dom.Element} node.
 * In other words, a node that accepts children.</p>
 *
 * <p>An <code>IllegalStateException</code> is thrown if
 * <code>nextSibling</code> is not <code>null</code> and
 * <code>node</code> is not a parent of <code>nextSibling</code>.
 * An <code>IllegalStateException</code> is thrown if <code>node</code> is <code>null</code> and
 * <code>nextSibling</code> is not <code>null</code>.</p>
 *
 * @param node The node to which the transformation will be appended.
 *
 * @throws IllegalStateException If <code>nextSibling</code> is not
 *   <code>null</code> and
 *   <code>nextSibling</code> is not a child of <code>node</code> or
 *   <code>node</code> is <code>null</code> and
 *   <code>nextSibling</code> is not <code>null</code>.
 */
public void setNode(Node node) {
    // does the corrent parent/child relationship exist?
    if (nextSibling != null) {
        // cannot be a sibling of a null node
        if (node == null) {
            throw new IllegalStateException("Cannot create a DOMResult when the nextSibling is contained by the \"null\" node.");
        }

        // nextSibling contained by node?
        if ((node.compareDocumentPosition(nextSibling)&Node.DOCUMENT_POSITION_CONTAINED_BY)==0) {
            throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is not contained by the node.");
        }
    }

    this.node = node;
}
 
Example 8
Source File: DOMResult.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * <p>Set the child node before which the result nodes will be inserted.</p>
 *
 * <p>Use <code>nextSibling</code> to specify the child node
 * before which the result nodes should be inserted.
 * If <code>nextSibling</code> is not a descendant of <code>node</code>,
 * then an <code>IllegalArgumentException</code> is thrown.
 * If <code>node</code> is <code>null</code> and <code>nextSibling</code> is not <code>null</code>,
 * then an <code>IllegalStateException</code> is thrown.
 * If <code>nextSibling</code> is <code>null</code>,
 * then the behavior is the same as calling {@link #DOMResult(Node node)},
 * i.e. append the result nodes as the last child of the specified <code>node</code>.</p>
 *
 * @param nextSibling The child node before which the result nodes will be inserted.
 *
 * @throws IllegalArgumentException If <code>nextSibling</code> is not a
 *   descendant of <code>node</code>.
 * @throws IllegalStateException If <code>node</code> is <code>null</code>
 *   and <code>nextSibling</code> is not <code>null</code>.
 *
 * @since 1.5
 */
public void setNextSibling(Node nextSibling) {

    // does the corrent parent/child relationship exist?
    if (nextSibling != null) {
        // cannot be a sibling of a null node
        if (node == null) {
            throw new IllegalStateException("Cannot create a DOMResult when the nextSibling is contained by the \"null\" node.");
        }

        // nextSibling contained by node?
        if ((node.compareDocumentPosition(nextSibling)&Node.DOCUMENT_POSITION_CONTAINED_BY)==0) {
            throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is not contained by the node.");
        }
    }

    this.nextSibling = nextSibling;
}
 
Example 9
Source File: DOMResult.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * <p>Use a DOM node to create a new output target specifying the child node where the result nodes should be inserted before.</p>
 *
 * <p>In practice, <code>node</code> and <code>nextSibling</code> should be
 * a {@link org.w3c.dom.Document} node,
 * a {@link org.w3c.dom.DocumentFragment} node, or
 * a {@link org.w3c.dom.Element} node.
 * In other words, a node that accepts children.</p>
 *
 * <p>Use <code>nextSibling</code> to specify the child node
 * where the result nodes should be inserted before.
 * If <code>nextSibling</code> is not a sibling of <code>node</code>,
 * then an <code>IllegalArgumentException</code> is thrown.
 * If <code>node</code> is <code>null</code> and <code>nextSibling</code> is not <code>null</code>,
 * then an <code>IllegalArgumentException</code> is thrown.
 * If <code>nextSibling</code> is <code>null</code>,
 * then the behavior is the same as calling {@link #DOMResult(Node node)},
 * i.e. append the result nodes as the last child of the specified <code>node</code>.</p>
 *
 * <p><code>systemId</code> will be set to <code>null</code>.</p>
 *
 * @param node The DOM node that will contain the result tree.
 * @param nextSibling The child node where the result nodes should be inserted before.
 *
 * @throws IllegalArgumentException If <code>nextSibling</code> is not a sibling of <code>node</code> or
 *   <code>node</code> is <code>null</code> and <code>nextSibling</code>
 *   is not <code>null</code>.
 *
 * @since 1.5
 */
public DOMResult(Node node, Node nextSibling) {

    // does the corrent parent/child relationship exist?
    if (nextSibling != null) {
        // cannot be a sibling of a null node
        if (node == null) {
            throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is contained by the \"null\" node.");
        }

        // nextSibling contained by node?
        if ((node.compareDocumentPosition(nextSibling)&Node.DOCUMENT_POSITION_CONTAINED_BY)==0) {
            throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is not contained by the node.");
        }
    }

    setNode(node);
    setNextSibling(nextSibling);
    setSystemId(null);
}
 
Example 10
Source File: DOMResult.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * <p>Use a DOM node to create a new output target specifying the child node where the result nodes should be inserted before.</p>
 *
 * <p>In practice, <code>node</code> and <code>nextSibling</code> should be
 * a {@link org.w3c.dom.Document} node,
 * a {@link org.w3c.dom.DocumentFragment} node, or
 * a {@link org.w3c.dom.Element} node.
 * In other words, a node that accepts children.</p>
 *
 * <p>Use <code>nextSibling</code> to specify the child node
 * where the result nodes should be inserted before.
 * If <code>nextSibling</code> is not a sibling of <code>node</code>,
 * then an <code>IllegalArgumentException</code> is thrown.
 * If <code>node</code> is <code>null</code> and <code>nextSibling</code> is not <code>null</code>,
 * then an <code>IllegalArgumentException</code> is thrown.
 * If <code>nextSibling</code> is <code>null</code>,
 * then the behavior is the same as calling {@link #DOMResult(Node node)},
 * i.e. append the result nodes as the last child of the specified <code>node</code>.</p>
 *
 * <p><code>systemId</code> will be set to <code>null</code>.</p>
 *
 * @param node The DOM node that will contain the result tree.
 * @param nextSibling The child node where the result nodes should be inserted before.
 *
 * @throws IllegalArgumentException If <code>nextSibling</code> is not a sibling of <code>node</code> or
 *   <code>node</code> is <code>null</code> and <code>nextSibling</code>
 *   is not <code>null</code>.
 *
 * @since 1.5
 */
public DOMResult(Node node, Node nextSibling) {

    // does the corrent parent/child relationship exist?
    if (nextSibling != null) {
        // cannot be a sibling of a null node
        if (node == null) {
            throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is contained by the \"null\" node.");
        }

        // nextSibling contained by node?
        if ((node.compareDocumentPosition(nextSibling)&Node.DOCUMENT_POSITION_CONTAINED_BY)==0) {
            throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is not contained by the node.");
        }
    }

    setNode(node);
    setNextSibling(nextSibling);
    setSystemId(null);
}
 
Example 11
Source File: DOMResult.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * <p>Use a DOM node to create a new output target specifying the child node where the result nodes should be inserted before and
 * the specified System ID.</p>
 *
 * <p>In practice, <code>node</code> and <code>nextSibling</code> should be
 * a {@link org.w3c.dom.Document} node,
 * a {@link org.w3c.dom.DocumentFragment} node, or a
 * {@link org.w3c.dom.Element} node.
 * In other words, a node that accepts children.</p>
 *
 * <p>Use <code>nextSibling</code> to specify the child node
 * where the result nodes should be inserted before.
 * If <code>nextSibling</code> is not a sibling of <code>node</code>,
 * then an <code>IllegalArgumentException</code> is thrown.
 * If <code>node</code> is <code>null</code> and <code>nextSibling</code> is not <code>null</code>,
 * then an <code>IllegalArgumentException</code> is thrown.
 * If <code>nextSibling</code> is <code>null</code>,
 * then the behavior is the same as calling {@link #DOMResult(Node node, String systemId)},
 * i.e. append the result nodes as the last child of the specified node and use the specified System ID.</p>
 *
 * @param node The DOM node that will contain the result tree.
 * @param nextSibling The child node where the result nodes should be inserted before.
 * @param systemId The system identifier which may be used in association with this node.
 *
 * @throws IllegalArgumentException If <code>nextSibling</code> is not a
 *   sibling of <code>node</code> or
 *   <code>node</code> is <code>null</code> and <code>nextSibling</code>
 *   is not <code>null</code>.
 *
 * @since 1.5
 */
public DOMResult(Node node, Node nextSibling, String systemId) {

    // does the corrent parent/child relationship exist?
    if (nextSibling != null) {
        // cannot be a sibling of a null node
        if (node == null) {
            throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is contained by the \"null\" node.");
        }

        // nextSibling contained by node?
        if ((node.compareDocumentPosition(nextSibling)&Node.DOCUMENT_POSITION_CONTAINED_BY)==0) {
            throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is not contained by the node.");
        }
    }

    setNode(node);
    setNextSibling(nextSibling);
    setSystemId(systemId);
}
 
Example 12
Source File: DOMResult.java    From j2objc with Apache License 2.0 4 votes vote down vote up
/**
 * <p>Use a DOM node to create a new output target specifying the child node where the result nodes should be inserted before.</p>
 *
 * <p>In practice, <code>node</code> and <code>nextSibling</code> should be
 * a {@link org.w3c.dom.Document} node,
 * a {@link org.w3c.dom.DocumentFragment} node, or
 * a {@link org.w3c.dom.Element} node.
 * In other words, a node that accepts children.</p>
 *
 * <p>Use <code>nextSibling</code> to specify the child node
 * where the result nodes should be inserted before.
 * If <code>nextSibling</code> is not a sibling of <code>node</code>,
 * then an <code>IllegalArgumentException</code> is thrown.
 * If <code>node</code> is <code>null</code> and <code>nextSibling</code> is not <code>null</code>,
 * then an <code>IllegalArgumentException</code> is thrown.
 * If <code>nextSibling</code> is <code>null</code>,
 * then the behavior is the same as calling {@link #DOMResult(Node node)},
 * i.e. append the result nodes as the last child of the specified <code>node</code>.</p>
 *
 * <p><code>systemId</code> will be set to <code>null</code>.</p>
 *
 * @param node The DOM node that will contain the result tree.
 * @param nextSibling The child node where the result nodes should be inserted before.
 *
 * @throws IllegalArgumentException If <code>nextSibling</code> is not a sibling of <code>node</code>.
 * @throws IllegalArgumentException If <code>node</code> is <code>null</code> and <code>nextSibling</code> is not <code>null</code>.
 *
 * @since 1.5
 */
public DOMResult(Node node, Node nextSibling) {

    // does the corrent parent/child relationship exist?
    if (nextSibling != null) {
        // cannot be a sibling of a null node
        if (node == null) {
            throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is contained by the \"null\" node.");
        }

        // nextSibling contained by node?
        if ((node.compareDocumentPosition(nextSibling)&Node.DOCUMENT_POSITION_CONTAINED_BY)==0) {
            throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is not contained by the node.");
        }
    }

    setNode(node);
    setNextSibling(nextSibling);
    setSystemId(null);
}
 
Example 13
Source File: DOMResult.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * <p>Use a DOM node to create a new output target specifying the child node where the result nodes should be inserted before.</p>
 *
 * <p>In practice, <code>node</code> and <code>nextSibling</code> should be
 * a {@link org.w3c.dom.Document} node,
 * a {@link org.w3c.dom.DocumentFragment} node, or
 * a {@link org.w3c.dom.Element} node.
 * In other words, a node that accepts children.</p>
 *
 * <p>Use <code>nextSibling</code> to specify the child node
 * where the result nodes should be inserted before.
 * If <code>nextSibling</code> is not a sibling of <code>node</code>,
 * then an <code>IllegalArgumentException</code> is thrown.
 * If <code>node</code> is <code>null</code> and <code>nextSibling</code> is not <code>null</code>,
 * then an <code>IllegalArgumentException</code> is thrown.
 * If <code>nextSibling</code> is <code>null</code>,
 * then the behavior is the same as calling {@link #DOMResult(Node node)},
 * i.e. append the result nodes as the last child of the specified <code>node</code>.</p>
 *
 * <p><code>systemId</code> will be set to <code>null</code>.</p>
 *
 * @param node The DOM node that will contain the result tree.
 * @param nextSibling The child node where the result nodes should be inserted before.
 *
 * @throws IllegalArgumentException If <code>nextSibling</code> is not a sibling of <code>node</code> or
 *   <code>node</code> is <code>null</code> and <code>nextSibling</code>
 *   is not <code>null</code>.
 *
 * @since 1.5
 */
public DOMResult(Node node, Node nextSibling) {

    // does the corrent parent/child relationship exist?
    if (nextSibling != null) {
        // cannot be a sibling of a null node
        if (node == null) {
            throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is contained by the \"null\" node.");
        }

        // nextSibling contained by node?
        if ((node.compareDocumentPosition(nextSibling)&Node.DOCUMENT_POSITION_CONTAINED_BY)==0) {
            throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is not contained by the node.");
        }
    }

    setNode(node);
    setNextSibling(nextSibling);
    setSystemId(null);
}
 
Example 14
Source File: DOMResult.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * <p>Set the child node before which the result nodes will be inserted.</p>
 *
 * <p>Use <code>nextSibling</code> to specify the child node
 * before which the result nodes should be inserted.
 * If <code>nextSibling</code> is not a descendant of <code>node</code>,
 * then an <code>IllegalArgumentException</code> is thrown.
 * If <code>node</code> is <code>null</code> and <code>nextSibling</code> is not <code>null</code>,
 * then an <code>IllegalStateException</code> is thrown.
 * If <code>nextSibling</code> is <code>null</code>,
 * then the behavior is the same as calling {@link #DOMResult(Node node)},
 * i.e. append the result nodes as the last child of the specified <code>node</code>.</p>
 *
 * @param nextSibling The child node before which the result nodes will be inserted.
 *
 * @throws IllegalArgumentException If <code>nextSibling</code> is not a
 *   descendant of <code>node</code>.
 * @throws IllegalStateException If <code>node</code> is <code>null</code>
 *   and <code>nextSibling</code> is not <code>null</code>.
 *
 * @since 1.5
 */
public void setNextSibling(Node nextSibling) {

    // does the corrent parent/child relationship exist?
    if (nextSibling != null) {
        // cannot be a sibling of a null node
        if (node == null) {
            throw new IllegalStateException("Cannot create a DOMResult when the nextSibling is contained by the \"null\" node.");
        }

        // nextSibling contained by node?
        if ((node.compareDocumentPosition(nextSibling)&Node.DOCUMENT_POSITION_CONTAINED_BY)==0) {
            throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is not contained by the node.");
        }
    }

    this.nextSibling = nextSibling;
}
 
Example 15
Source File: DOMResult.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * <p>Set the child node before which the result nodes will be inserted.</p>
 *
 * <p>Use <code>nextSibling</code> to specify the child node
 * before which the result nodes should be inserted.
 * If <code>nextSibling</code> is not a descendant of <code>node</code>,
 * then an <code>IllegalArgumentException</code> is thrown.
 * If <code>node</code> is <code>null</code> and <code>nextSibling</code> is not <code>null</code>,
 * then an <code>IllegalStateException</code> is thrown.
 * If <code>nextSibling</code> is <code>null</code>,
 * then the behavior is the same as calling {@link #DOMResult(Node node)},
 * i.e. append the result nodes as the last child of the specified <code>node</code>.</p>
 *
 * @param nextSibling The child node before which the result nodes will be inserted.
 *
 * @throws IllegalArgumentException If <code>nextSibling</code> is not a
 *   descendant of <code>node</code>.
 * @throws IllegalStateException If <code>node</code> is <code>null</code>
 *   and <code>nextSibling</code> is not <code>null</code>.
 *
 * @since 1.5
 */
public void setNextSibling(Node nextSibling) {

    // does the corrent parent/child relationship exist?
    if (nextSibling != null) {
        // cannot be a sibling of a null node
        if (node == null) {
            throw new IllegalStateException("Cannot create a DOMResult when the nextSibling is contained by the \"null\" node.");
        }

        // nextSibling contained by node?
        if ((node.compareDocumentPosition(nextSibling)&Node.DOCUMENT_POSITION_CONTAINED_BY)==0) {
            throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is not contained by the node.");
        }
    }

    this.nextSibling = nextSibling;
}
 
Example 16
Source File: DOMResult.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * <p>Use a DOM node to create a new output target specifying the child node where the result nodes should be inserted before and
 * the specified System ID.</p>
 *
 * <p>In practice, <code>node</code> and <code>nextSibling</code> should be
 * a {@link org.w3c.dom.Document} node,
 * a {@link org.w3c.dom.DocumentFragment} node, or a
 * {@link org.w3c.dom.Element} node.
 * In other words, a node that accepts children.</p>
 *
 * <p>Use <code>nextSibling</code> to specify the child node
 * where the result nodes should be inserted before.
 * If <code>nextSibling</code> is not a sibling of <code>node</code>,
 * then an <code>IllegalArgumentException</code> is thrown.
 * If <code>node</code> is <code>null</code> and <code>nextSibling</code> is not <code>null</code>,
 * then an <code>IllegalArgumentException</code> is thrown.
 * If <code>nextSibling</code> is <code>null</code>,
 * then the behavior is the same as calling {@link #DOMResult(Node node, String systemId)},
 * i.e. append the result nodes as the last child of the specified node and use the specified System ID.</p>
 *
 * @param node The DOM node that will contain the result tree.
 * @param nextSibling The child node where the result nodes should be inserted before.
 * @param systemId The system identifier which may be used in association with this node.
 *
 * @throws IllegalArgumentException If <code>nextSibling</code> is not a
 *   sibling of <code>node</code> or
 *   <code>node</code> is <code>null</code> and <code>nextSibling</code>
 *   is not <code>null</code>.
 *
 * @since 1.5
 */
public DOMResult(Node node, Node nextSibling, String systemId) {

    // does the corrent parent/child relationship exist?
    if (nextSibling != null) {
        // cannot be a sibling of a null node
        if (node == null) {
            throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is contained by the \"null\" node.");
        }

        // nextSibling contained by node?
        if ((node.compareDocumentPosition(nextSibling)&Node.DOCUMENT_POSITION_CONTAINED_BY)==0) {
            throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is not contained by the node.");
        }
    }

    setNode(node);
    setNextSibling(nextSibling);
    setSystemId(systemId);
}
 
Example 17
Source File: DOMResult.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * <p>Use a DOM node to create a new output target specifying the child node where the result nodes should be inserted before.</p>
 *
 * <p>In practice, <code>node</code> and <code>nextSibling</code> should be
 * a {@link org.w3c.dom.Document} node,
 * a {@link org.w3c.dom.DocumentFragment} node, or
 * a {@link org.w3c.dom.Element} node.
 * In other words, a node that accepts children.</p>
 *
 * <p>Use <code>nextSibling</code> to specify the child node
 * where the result nodes should be inserted before.
 * If <code>nextSibling</code> is not a sibling of <code>node</code>,
 * then an <code>IllegalArgumentException</code> is thrown.
 * If <code>node</code> is <code>null</code> and <code>nextSibling</code> is not <code>null</code>,
 * then an <code>IllegalArgumentException</code> is thrown.
 * If <code>nextSibling</code> is <code>null</code>,
 * then the behavior is the same as calling {@link #DOMResult(Node node)},
 * i.e. append the result nodes as the last child of the specified <code>node</code>.</p>
 *
 * <p><code>systemId</code> will be set to <code>null</code>.</p>
 *
 * @param node The DOM node that will contain the result tree.
 * @param nextSibling The child node where the result nodes should be inserted before.
 *
 * @throws IllegalArgumentException If <code>nextSibling</code> is not a sibling of <code>node</code> or
 *   <code>node</code> is <code>null</code> and <code>nextSibling</code>
 *   is not <code>null</code>.
 *
 * @since 1.5
 */
public DOMResult(Node node, Node nextSibling) {

    // does the corrent parent/child relationship exist?
    if (nextSibling != null) {
        // cannot be a sibling of a null node
        if (node == null) {
            throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is contained by the \"null\" node.");
        }

        // nextSibling contained by node?
        if ((node.compareDocumentPosition(nextSibling)&Node.DOCUMENT_POSITION_CONTAINED_BY)==0) {
            throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is not contained by the node.");
        }
    }

    setNode(node);
    setNextSibling(nextSibling);
    setSystemId(null);
}
 
Example 18
Source File: DOMResult.java    From Java8CN with Apache License 2.0 4 votes vote down vote up
/**
 * <p>Set the child node before which the result nodes will be inserted.</p>
 *
 * <p>Use <code>nextSibling</code> to specify the child node
 * before which the result nodes should be inserted.
 * If <code>nextSibling</code> is not a descendant of <code>node</code>,
 * then an <code>IllegalArgumentException</code> is thrown.
 * If <code>node</code> is <code>null</code> and <code>nextSibling</code> is not <code>null</code>,
 * then an <code>IllegalStateException</code> is thrown.
 * If <code>nextSibling</code> is <code>null</code>,
 * then the behavior is the same as calling {@link #DOMResult(Node node)},
 * i.e. append the result nodes as the last child of the specified <code>node</code>.</p>
 *
 * @param nextSibling The child node before which the result nodes will be inserted.
 *
 * @throws IllegalArgumentException If <code>nextSibling</code> is not a
 *   descendant of <code>node</code>.
 * @throws IllegalStateException If <code>node</code> is <code>null</code>
 *   and <code>nextSibling</code> is not <code>null</code>.
 *
 * @since 1.5
 */
public void setNextSibling(Node nextSibling) {

    // does the corrent parent/child relationship exist?
    if (nextSibling != null) {
        // cannot be a sibling of a null node
        if (node == null) {
            throw new IllegalStateException("Cannot create a DOMResult when the nextSibling is contained by the \"null\" node.");
        }

        // nextSibling contained by node?
        if ((node.compareDocumentPosition(nextSibling)&Node.DOCUMENT_POSITION_CONTAINED_BY)==0) {
            throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is not contained by the node.");
        }
    }

    this.nextSibling = nextSibling;
}
 
Example 19
Source File: DOMResult.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * <p>Set the node that will contain the result DOM tree.<p>
 *
 * <p>In practice, the node should be
 * a {@link org.w3c.dom.Document} node,
 * a {@link org.w3c.dom.DocumentFragment} node, or
 * a {@link org.w3c.dom.Element} node.
 * In other words, a node that accepts children.</p>
 *
 * <p>An <code>IllegalStateException</code> is thrown if
 * <code>nextSibling</code> is not <code>null</code> and
 * <code>node</code> is not a parent of <code>nextSibling</code>.
 * An <code>IllegalStateException</code> is thrown if <code>node</code> is <code>null</code> and
 * <code>nextSibling</code> is not <code>null</code>.</p>
 *
 * @param node The node to which the transformation will be appended.
 *
 * @throws IllegalStateException If <code>nextSibling</code> is not
 *   <code>null</code> and
 *   <code>nextSibling</code> is not a child of <code>node</code> or
 *   <code>node</code> is <code>null</code> and
 *   <code>nextSibling</code> is not <code>null</code>.
 */
public void setNode(Node node) {
    // does the corrent parent/child relationship exist?
    if (nextSibling != null) {
        // cannot be a sibling of a null node
        if (node == null) {
            throw new IllegalStateException("Cannot create a DOMResult when the nextSibling is contained by the \"null\" node.");
        }

        // nextSibling contained by node?
        if ((node.compareDocumentPosition(nextSibling)&Node.DOCUMENT_POSITION_CONTAINED_BY)==0) {
            throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is not contained by the node.");
        }
    }

    this.node = node;
}
 
Example 20
Source File: DOMResult.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Use a DOM node to create a new output target specifying the child
 * node where the result nodes should be inserted before and
 * the specified System ID.
 *
 * <p>In practice, {@code node} and {@code nextSibling} should be
 * a {@link org.w3c.dom.Document} node,
 * a {@link org.w3c.dom.DocumentFragment} node, or a
 * {@link org.w3c.dom.Element} node.
 * In other words, a node that accepts children.
 *
 * <p>Use {@code nextSibling} to specify the child node
 * where the result nodes should be inserted before.
 * If {@code nextSibling} is not a sibling of {@code node},
 * then an {@code IllegalArgumentException} is thrown.
 * If {@code node} is {@code null} and {@code nextSibling} is not {@code null},
 * then an {@code IllegalArgumentException} is thrown.
 * If {@code nextSibling} is {@code null},
 * then the behavior is the same as calling {@link #DOMResult(Node node, String systemId)},
 * i.e. append the result nodes as the last child of the specified
 * node and use the specified System ID.
 *
 * @param node The DOM node that will contain the result tree.
 * @param nextSibling The child node where the result nodes should be inserted before.
 * @param systemId The system identifier which may be used in association with this node.
 *
 * @throws IllegalArgumentException If {@code nextSibling} is not a
 *   sibling of {@code node} or
 *   {@code node} is {@code null} and {@code nextSibling}
 *   is not {@code null}.
 *
 * @since 1.5
 */
public DOMResult(Node node, Node nextSibling, String systemId) {

    // does the corrent parent/child relationship exist?
    if (nextSibling != null) {
        // cannot be a sibling of a null node
        if (node == null) {
            throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is contained by the \"null\" node.");
        }

        // nextSibling contained by node?
        if ((node.compareDocumentPosition(nextSibling)&Node.DOCUMENT_POSITION_CONTAINED_BY)==0) {
            throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is not contained by the node.");
        }
    }

    setNode(node);
    setNextSibling(nextSibling);
    setSystemId(systemId);
}