Search in sources :

Example 11 with ImmutableNode

use of org.sirix.node.interfaces.immutable.ImmutableNode in project sirix by sirixdb.

the class XdmNodeWriterTrxImpl method checkAncestors.

/**
 * Check ancestors of current node.
 *
 * @throws IllegalStateException if one of the ancestors is the node/subtree rooted at the node to
 *         move
 */
private void checkAncestors(final Node node) {
    assert node != null;
    final ImmutableNode item = getCurrentNode();
    while (getCurrentNode().hasParent()) {
        moveToParent();
        if (getCurrentNode().getNodeKey() == node.getNodeKey()) {
            throw new IllegalStateException("Moving one of the ancestor nodes is not permitted!");
        }
    }
    moveTo(item.getNodeKey());
}
Also used : ImmutableNode(org.sirix.node.interfaces.immutable.ImmutableNode)

Aggregations

ImmutableNode (org.sirix.node.interfaces.immutable.ImmutableNode)11 StructNode (org.sirix.node.interfaces.StructNode)9 ElementNode (org.sirix.node.ElementNode)7 AttributeNode (org.sirix.node.AttributeNode)6 CommentNode (org.sirix.node.CommentNode)6 NamespaceNode (org.sirix.node.NamespaceNode)6 PINode (org.sirix.node.PINode)6 TextNode (org.sirix.node.TextNode)6 NameNode (org.sirix.node.interfaces.NameNode)6 Node (org.sirix.node.interfaces.Node)6 ValueNode (org.sirix.node.interfaces.ValueNode)6 UnorderedKeyValuePage (org.sirix.page.UnorderedKeyValuePage)6 XMLShredder (org.sirix.service.xml.shredder.XMLShredder)2 XMLEventReader (javax.xml.stream.XMLEventReader)1 XMLEvent (javax.xml.stream.events.XMLEvent)1 Axis (org.sirix.api.Axis)1 DescendantAxis (org.sirix.axis.DescendantAxis)1 LevelOrderAxis (org.sirix.axis.LevelOrderAxis)1 PostOrderAxis (org.sirix.axis.PostOrderAxis)1 SirixIOException (org.sirix.exception.SirixIOException)1