Package org.exist.xquery.value

Examples of org.exist.xquery.value.NodeValue


                serializer.setReceiver(sax);

                sax.startDocument();

                while(siNode.hasNext()) {
                    final NodeValue next = (NodeValue)siNode.nextItem();
                    serializer.toSAX(next)
                }

                sax.endDocument();
               
View Full Code Here


        serializer.reset();
        serializer.setProperties(OUTPUT_PROPERTIES);
        for (SequenceIterator i = q.iterate(); i.hasNext();){
          Item item = i.nextItem();
          try {
              NodeValue node = (NodeValue)item;
              tmp += serializer.serialize(node);
          } catch (ClassCastException e){
            tmp += item.getStringValue();
          }
        }
View Full Code Here

              // Note: code order is important here,
              index.setDocument(doc, StreamListener.STORE);
              index.setMode(StreamListener.STORE);
 
              // Get 'solr' node from second parameter
              NodeValue descriptor = (NodeValue) args[1].itemAt(0);
             
              // Pas document and index instructions to indexer
              index.indexNonXML(descriptor);
             
              if (flush) {
View Full Code Here

    public DiffFunction(XQueryContext context) {
        super(context, signature);
    }

    public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathException {
        NodeValue nv1 = (NodeValue) args[0].itemAt(0);
        NodeValue nv2 = (NodeValue) args[1].itemAt(0);
        if (nv1.getImplementationType() != NodeValue.PERSISTENT_NODE ||
                nv2.getImplementationType() != NodeValue.PERSISTENT_NODE)
            throw new XPathException(this, "diff function only works on persistent documents stored in the db");
        DocumentImpl doc1 = ((NodeProxy)nv1).getDocument();
        DocumentImpl doc2 = ((NodeProxy)nv2).getDocument();

        context.pushDocumentContext();
View Full Code Here

  public Sequence eval(Sequence[] args, Sequence contextSequence)
      throws XPathException {
    if (args[0].isEmpty())
      return args[0];
   
    NodeValue nv = (NodeValue) args[0].itemAt(0);
    if (!nv.isPersistentSet())
      return nv;
    NodeProxy node = (NodeProxy) nv;
   
    String matchStr = null;
    NodeId nodeId = null;
View Full Code Here

                    Type.getTypeName(ls.itemAt(0).getType()) + "'");}
            if (!Type.subTypeOf(rs.itemAt(0).getType(), Type.NODE))
                {throw new XPathException(this, ErrorCodes.XPTY0004,
                    "right item is not a node; got '" +
                    Type.getTypeName(rs.itemAt(0).getType()) + "'");}
            final NodeValue lv = (NodeValue)ls.itemAt(0);
            final NodeValue rv = (NodeValue)rs.itemAt(0);
            if (lv.getImplementationType() != rv.getImplementationType()) {
                // different implementations : can't be the same nodes
                result =  BooleanValue.FALSE;
            } else {
                switch(relation) {
                case Constants.IS:
View Full Code Here

               
                if (!Type.subTypeOf(nodes.itemAt(0).getType(), Type.NODE))
                  {throw new XPathException(this, ErrorCodes.XPTY0004,
                      "fn:idref() argument is not a node");}
               
                NodeValue node = (NodeValue)nodes.itemAt(0);
                if (node.getImplementationType() == NodeValue.IN_MEMORY_NODE)
                  //TODO : how to enforce this ?
                  //If $node, or the context item if the second argument is omitted,
                  //is a node in a tree whose root is not a document node [err:FODC0001] is raised                    processInMem = true;
                    {processInMem = true;}
                else {
View Full Code Here

       
        Collection collection = null;
        final Item item = args[paramNumber].itemAt(0);
        if(Type.subTypeOf(item.getType(), Type.NODE))
        {
          final NodeValue node = (NodeValue)item;
          logger.debug("Found node");
          if(node.getImplementationType() == NodeValue.PERSISTENT_NODE)
          {
            final org.exist.collections.Collection internalCol = ((NodeProxy)node).getDocument().getCollection();
            logger.debug("Found node");
            try
            {
View Full Code Here

  /* (non-Javadoc)
   * @see org.exist.xquery.BasicFunction#eval(org.exist.xquery.value.Sequence[], org.exist.xquery.value.Sequence)
   */
  public Sequence evalWithCollection(Collection c, Sequence[] args, Sequence contextSequence)
        throws XPathException {
    final NodeValue data = (NodeValue) args[1].itemAt(0);
    final StringWriter writer = new StringWriter();
    final Properties properties = new Properties();
    properties.setProperty(OutputKeys.INDENT, "yes");
        final DOMSerializer serializer = new ExtendedDOMSerializer(context.getBroker(), writer, properties);
    try {
      serializer.serialize(data.getNode());
    } catch(final TransformerException e) {
      logger.debug("Exception while serializing XUpdate document", e);
      throw new XPathException(this, "Exception while serializing XUpdate document: " + e.getMessage(), e);
    }
    final String xupdate = writer.toString();
View Full Code Here

            serializer.setSAXHandlers(sax, sax);

            sax.startDocument();
           
            while(itSequence.hasNext()) {
               NodeValue next = (NodeValue)itSequence.nextItem();
               serializer.toSAX(next)
            }
           
            sax.endDocument();
            writer.close();
View Full Code Here

TOP

Related Classes of org.exist.xquery.value.NodeValue

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.