Package org.exist.numbering

Examples of org.exist.numbering.NodeId


     * p.
     */
    private static NodeSet ancestorsForChild(NodeSet ancestors, NodeProxy child,
            boolean directParent, boolean includeSelf) {
        final NodeSet result = new NewArrayNodeSet(5);
        NodeId nodeId = child.getNodeId();
        NodeProxy temp = ancestors.get(child.getDocument(), nodeId);
        if (includeSelf && temp != null)
            {result.add(temp);}
        while (nodeId != null && nodeId != NodeId.DOCUMENT_NODE) {
            nodeId = nodeId.getParentId();
            temp = ancestors.get(child.getDocument(), nodeId);
            if (temp != null)
                {result.add(temp);}
            else if (directParent)
                {return result;}
View Full Code Here


                int startOffset = 0;
                try {
                    final XMLStreamReader reader = broker.getXMLStreamReader(p, false);
                    while (reader.hasNext()) {
                        final int ev = reader.next();
                        final NodeId nodeId = (NodeId) reader.getProperty(ExtendedXMLStreamReader.PROPERTY_NODE_ID);
                        if (nodeId.equals(proxy.getNodeId()))
                            {break;}
                        if (ev == XMLStreamConstants.CHARACTERS)
                            {startOffset += reader.getText().length();}
                    }
                } catch (final IOException e) {
View Full Code Here

    /**
     * @see org.w3c.dom.Node#getParentNode()
     */
    public Node getParentNode() {
        final NodeId parentId = nodeId.getParentId();
        if (parentId == NodeId.DOCUMENT_NODE)
            {return ownerDocument;}
        // Filter out the temporary nodes wrapper element
        if (parentId.getTreeLevel() == 1 && ((DocumentImpl)getOwnerDocument()).getCollection().isTempCollection())
            {return ownerDocument;}
        return ownerDocument.getNode(parentId);
    }
View Full Code Here

                final EmbeddedXMLStreamReader reader = broker.getXMLStreamReader(parent, true);
                final int level = nodeId.getTreeLevel();
                StoredNode last = null;
                while (reader.hasNext()) {
                    final int status = reader.next();
                    final NodeId currentId = (NodeId) reader.getProperty(ExtendedXMLStreamReader.PROPERTY_NODE_ID);
                    if (status != XMLStreamConstants.END_ELEMENT && currentId.getTreeLevel() == level) {
                        if (currentId.equals(nodeId))
                            {return last;}
                        last = reader.getNode();
                    }
                }
            } catch (final IOException e) {
                LOG.error("Internal error while reading child nodes: " + e.getMessage(), e);
                //TODO : throw exception -pb
            } catch (final XMLStreamException e) {
                LOG.error("Internal error while reading child nodes: " + e.getMessage(), e);
              //TODO : throw exception -pb
            } catch (final EXistException e) {
                LOG.error("Internal error while reading child nodes: " + e.getMessage(), e);
              //TODO : throw exception -pb
            } finally {
                ownerDocument.getBrokerPool().release(broker);
            }
            return null;
        }
        final NodeId firstChild = parent.getNodeId().newChild();
        if (nodeId.equals(firstChild))
            {return null;}
        final NodeId siblingId = nodeId.precedingSibling();
        return ownerDocument.getNode(siblingId);
    }
View Full Code Here

                broker = ownerDocument.getBrokerPool().get(null);
                final EmbeddedXMLStreamReader reader = broker.getXMLStreamReader(parent, true);
                final int level = nodeId.getTreeLevel();
                while (reader.hasNext()) {
                    final int status = reader.next();
                    final NodeId currentId = (NodeId) reader.getProperty(ExtendedXMLStreamReader.PROPERTY_NODE_ID);
                    if (status != XMLStreamConstants.END_ELEMENT && currentId.getTreeLevel() == level) {
                        if (currentId.compareTo(nodeId) > 0)
                            {return reader.getNode();}
                    }
                }
            } catch (final IOException e) {
                LOG.error("Internal error while reading child nodes: " + e.getMessage(), e);
                //TODO : throw exception -pb
            } catch (final XMLStreamException e) {
                LOG.error("Internal error while reading child nodes: " + e.getMessage(), e);
              //TODO : throw exception -pb
            } catch (final EXistException e) {
                LOG.error("Internal error while reading child nodes: " + e.getMessage(), e);
              //TODO : throw exception -pb
            } finally {
                ownerDocument.getBrokerPool().release(broker);
            }
            return null;
        }
        final NodeId siblingId = nodeId.nextSibling();
        return ownerDocument.getNode(siblingId);
    }
View Full Code Here

                    LOG.debug("Unhandled node type: " + node.getNodeType());
            }
        }
        if(node.hasChildNodes()) {
            final int count = node.getChildCount();
            NodeId nodeId = node.getNodeId();
            for(int i = 0; i < count; i++) {
                final StoredNode child = iterator.next();
                oldNodeId = child.getNodeId();
                if(defragment) {
                    if(i == 0) {
                        nodeId = nodeId.newChild();
                    } else {
                        nodeId = nodeId.nextSibling();
                    }
                    child.setNodeId(nodeId);
                }
                copyNodes(transaction, iterator, child, currentPath, newDoc, defragment, index, listener, oldNodeId);
            }
View Full Code Here

                    LOG.fatal("child " + i + " not found for node: " + node.getNodeName() +
                        ": " + node.getNodeId() + "; children = " + node.getChildCount());
                    docIsValid = false;
                    //TODO : emergency exit ?
                }
                final NodeId parentId = child.getNodeId().getParentId();
                if(!parentId.equals(node.getNodeId())) {
                    LOG.fatal(child.getNodeId() + " is not a child of " + node.getNodeId());
                    docIsValid = false;
                }
                boolean check = checkNodeTree(iterator, child, buf);
                if(docIsValid) {
View Full Code Here

            //Remove previously found matches on current
            current.setMatches(null);
            //Iterate on attach matches, with unicity of related nodeproxy gid
            String term;
            while(nextMatch != null) {
                final NodeId nodeId= nextMatch.getNodeId();
                //If current node id has not been previously processed
                if (!matchNodeIDs.contains(nodeId)) {
                    final NodeProxy mcurrent = new NodeProxy(current.getDocument(), nodeId);
                    Match match = null;
                    int firstOffset = -1;
View Full Code Here

            //Remove previously found matches on current
            current.setMatches(null);
            //Iterate on attach matches, with unicity of related nodeproxy gid
            while (nextMatch != null) {
                final Hashtable<String, Match> matchTable = new Hashtable<String, Match>();
                final NodeId nodeId = nextMatch.getNodeId();
                //If current node id has not been previously processed
                if (!matchGid.contains(nodeId)) {
                    final NodeProxy mcurrent = new NodeProxy(current.getDocument(), nodeId);
                    //Add it in node id array
                    matchGid.add(nodeId);
View Full Code Here

   */
  public Sequence eval(Sequence[] args, Sequence contextSequence)
      throws XPathException {
   
        final String id = args[1].itemAt(0).getStringValue();
        final NodeId nodeId = context.getBroker().getBrokerPool().getNodeFactory().createFromString(id);
        final NodeValue docNode = (NodeValue) args[0].itemAt(0);
        if (docNode.getImplementationType() == NodeValue.IN_MEMORY_NODE) {
            return ((NodeImpl) docNode).getDocument().getNodeById(nodeId);
        } else {
            final DocumentImpl doc = ((NodeProxy)docNode).getDocument();
View Full Code Here

TOP

Related Classes of org.exist.numbering.NodeId

Copyright © 2018 www.massapicom. 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.