Examples of NodeProxy


Examples of org.exist.dom.NodeProxy

            {context.getProfiler().message(this, Profiler.OPTIMIZATION_FLAGS, "OPTIMIZATION CHOICE", "nodeSetCompare");}   
    final NodeSet result = new ExtArrayNodeSet();
        final Collator collator = getCollator(contextSequence);
        if (contextSequence != null && !contextSequence.isEmpty()) {
            for (final Iterator<NodeProxy> i = nodes.iterator(); i.hasNext();) {
                final NodeProxy current = i.next();
                ContextItem context = current.getContext();
                if (context==null) {
                   throw new XPathException(this,"Context is missing for node set comparison");
                }
                do {
                    final AtomicValue lv = current.atomize();
                    final Sequence rs = getRight().eval(context.getNode().toSequence());                   
                    if (!rs.hasOne())
                        {throw new XPathException(this,
                                "Type error: sequence with less or more than one item is not allowed here");}                   
                    if (compareAtomic(collator, lv, rs.itemAt(0).atomize(), Constants.TRUNC_NONE, relation))
                        {result.add(current);}
                } while ((context = context.getNextDirect()) != null);
            }
        } else {
            final Sequence rs = getRight().eval(null);
            if (!rs.hasOne())
                {throw new XPathException(this,
                        "Type error: sequence with less or more than one item is not allowed here");}
            final AtomicValue rv = rs.itemAt(0).atomize();
            for (final Iterator<NodeProxy> i = nodes.iterator(); i.hasNext();) {
                final NodeProxy current = i.next();
                final AtomicValue lv = current.atomize();
                if (compareAtomic(collator, lv, rv, Constants.TRUNC_NONE, Constants.EQ))
                    {result.add(current);}
            }
        }
        return result;
View Full Code Here

Examples of org.exist.dom.NodeProxy

            nextCollection = null;
            while (pos <= size) {
                if (Type.subTypeOf(values[pos].getType(), Type.NODE)) {
                    final NodeValue node = (NodeValue) values[pos];
                    if (node.getImplementationType() == NodeValue.PERSISTENT_NODE) {
                        final NodeProxy p = (NodeProxy) node;
                        if (!p.getDocument().getCollection().equals(oldCollection)) {
                            nextCollection = p.getDocument().getCollection();
                            break;
                        }
                    }
                }
                pos++;
View Full Code Here

Examples of org.exist.dom.NodeProxy

   
    // Scaling last
    int lastlo=last+lo;
   
    for(int k=hi; k>lo; k--) {
      final NodeProxy temp=a[k];
      a[k]=a[lo];
      siftdownByNodeId(a, k, lo, temp, drop);
      if (k==lastlo) {
        drop--;
        last/=2;
View Full Code Here

Examples of org.exist.dom.NodeProxy

    // 2b, just two elements
    if(lo0+1 == hi0)  {return;}
   
    // Last case, the general one
    for (int i = lo0 + 1; i < hi0; i++) {
      NodeProxy temp=a[i+1];
      if (temp.getNodeId().compareTo(a[i].getNodeId()) < 0) {
        int j;
       
        for(j=i;j>=lo0 && temp.getNodeId().compareTo(a[j].getNodeId()) < 0;j--) {
          a[j+1]=a[j];
        }
        a[j+1]=temp;
      }
    }
View Full Code Here

Examples of org.exist.dom.NodeProxy

        final Sequence seq = getArgument(0).eval(contextSequence, contextItem);
        Sequence result = Sequence.EMPTY_SEQUENCE;
        if (!seq.isEmpty()) {
            final NodeValue value = (NodeValue) seq.itemAt(0);
            if (value.getImplementationType() == NodeValue.PERSISTENT_NODE) {
                final NodeProxy node = (NodeProxy) value;
                //Returns the empty sequence if the node is not a document node.
                if (node.isDocument()) {
                    final XmldbURI path = node.getDocument().getURI();
                    result = new AnyURIValue(path);
                }
            } else {
                if (value instanceof DocumentImpl &&
                    ((DocumentImpl)value).getDocumentURI() != null) {
View Full Code Here

Examples of org.exist.dom.NodeProxy

                String uri = null;

                final NodeValue node = (NodeValue) args[1].itemAt(0);
                if (node.getImplementationType() == NodeValue.PERSISTENT_NODE) {
                    NodeProxy proxy = (NodeProxy) node;
                    final NodeSet ancestors = proxy.getAncestors(contextId, true);
                    for (final Iterator<NodeProxy> i = ancestors.iterator(); i.hasNext();) {
                        proxy = i.next();
                        final ElementImpl e = (ElementImpl) proxy.getNode();
                        uri = findNamespaceURI(e, prefix);
                        if (uri != null) {
                            break;
                        }
                    }
View Full Code Here

Examples of org.exist.dom.NodeProxy

  }

  private void getId(NodeSet result, DocumentSet docs, String id) throws XPathException {
    final NodeSet attribs = context.getBroker().getValueIndex().find(context.getWatchDog(), Constants.EQ, docs, null, -1, null, new StringValue(id, Type.ID));
    NodeProxy p;
    for (final NodeProxy n : attribs) {
      p = new NodeProxy(n.getDocument(), n.getNodeId().getParentId(), Node.ELEMENT_NODE);
      result.add(p);
    }
  }
View Full Code Here

Examples of org.exist.dom.NodeProxy

            if (!Type.subTypeOf(item.getType(), Type.NODE))
                {throw new XPathException(this, ErrorCodes.XPTY0004,  "Item is not a node; got '" + item + "'", seq);}
            final Sequence s = item.toSequence();

            if (s.isPersistentSet()) {
                final NodeProxy p = s.toNodeSet().get(0);
                result.add(new NodeProxy(p.getDocument()));
            } else {
                if (seq.hasOne() && item.getType() == Type.ATTRIBUTE) {
                  result.add(item);
                } else {
                  result.add(((NodeImpl)item).getDocument());
View Full Code Here

Examples of org.exist.dom.NodeProxy

                } catch (final BTreeException bte) {
                    LOG.error("report me", bte);
                }
            } while (parentPointer == KEY_NOT_FOUND);
            try {
                final NodeProxy parent = new NodeProxy(doc, nodeID, parentPointer);
                final EmbeddedXMLStreamReader cursor = broker.getXMLStreamReader(parent, true);
                while(cursor.hasNext()) {
                    final int status = cursor.next();
                    if (status != XMLStreamReader.END_ELEMENT) {
                        final NodeId nextId = (NodeId) cursor.getProperty(EmbeddedXMLStreamReader.PROPERTY_NODE_ID);
View Full Code Here

Examples of org.exist.dom.NodeProxy

            if (StorageAddress.hasAddress(address))
                {recordPos = findRecord(address);}
            if (recordPos == null) {
                // fallback to a BTree lookup if the node could not be found
                // by its storage address
                address = findValue(broker, new NodeProxy(node));
                if (address == BTree.KEY_NOT_FOUND) {
                    LOG.error("Node value not found: " + node);
                    //TODO : throw exception ? -pb
                    return null;
                }
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.