Package client.net.sf.saxon.ce.om

Examples of client.net.sf.saxon.ce.om.Item


        // This rather tortuous code is designed to ensure that we don't evaluate the
        // separator argument unless there are at least two items in the sequence.

        SequenceIterator iter = argument[0].iterate(c);
        Item it = iter.next();
        if (it == null) {
            return StringValue.EMPTY_STRING;
        }

        CharSequence first = it.getStringValueCS();

        it = iter.next();
        if (it == null) {
            return StringValue.makeStringValue(first);
        }

        FastStringBuffer sb = new FastStringBuffer(FastStringBuffer.SMALL);
        sb.append(first);

        // Type checking ensures that the separator is not an empty sequence
        if (argument.length == 1) {
            sb.append(it.getStringValueCS());
            while (true) {
                it = iter.next();
                if (it == null) {
                    return StringValue.makeStringValue(sb.condense());
                }
                sb.append(it.getStringValueCS());
            }

        } else {
            CharSequence sep = argument[1].evaluateItem(c).getStringValueCS();
            sb.append(sep);
            sb.append(it.getStringValueCS());

            while (true) {
                it = iter.next();
                if (it == null) {
                    return StringValue.makeStringValue(sb.condense());
                }
                sb.append(sep);
                sb.append(it.getStringValueCS());
            }
        }
    }
View Full Code Here


            // Optimization is only safe if evaluated as part of a complex content constructor
            // Start and end with an empty string to force space separation from any previous or following outputs
            out.append(StringValue.EMPTY_STRING, 0);

            SequenceIterator iter = argument[0].iterate(context);
            Item it = iter.next();
            if (it == null) {
                return;
            }

            CharSequence first = it.getStringValueCS();
            out.characters(first);

            it = iter.next();
            if (it == null) {
                out.append(StringValue.EMPTY_STRING, 0);
                return;
            }

            // Type checking ensures that the separator is not an empty sequence
            if (argument.length == 1) {
                out.characters(it.getStringValueCS());

                while (true) {
                    it = iter.next();
                    if (it == null) {
                        break;
                    }
                    out.characters(it.getStringValueCS());
                }
            } else {
                CharSequence sep = argument[1].evaluateItem(context).getStringValueCS();
                out.characters(sep);
                out.characters(it.getStringValueCS());

                while (true) {
                    it = iter.next();
                    if (it == null) {
                        break;
                    }
                    out.characters(sep);
                    out.characters(it.getStringValueCS());
                }

            }

View Full Code Here

    /**
    * Evaluate the function
    */

    public Item evaluateItem(XPathContext context) throws XPathException {
        Item val = argument[0].evaluateItem(context);
       
        if (LogConfiguration.loggingIsEnabled()) {
          String label = argument[1].evaluateAsString(context).toString();
          if (LogController.traceIsEnabled()) {
              notifyListener(label, Value.asValue(val), context);
View Full Code Here

            this.base = base;
            this.label = label;
        }

        public Item next() throws XPathException {
            Item n = base.next();
            if (n==null) {
                if (empty) {
                    traceItem(null, label);
                }
            } else {
View Full Code Here

            }
            DocumentInfo doc = pool.find(documentKey);
            if (doc != null) {
                return true;
            }
            Item item = DocumentFn.makeDoc(href, expressionBaseURI, context, getSourceLocator());
            if (item != null) {
                return true;
            } else {
                // The document does not exist; ensure that this remains the case
                pool.markUnavailable(documentKey);
View Full Code Here

        c2.setCurrentTemplateRule(null);

        if (containsTailCall) {
            if (LogConfiguration.loggingIsEnabled() && LogController.traceIsEnabled()) {
                TraceListener listener = LogController.getTraceListener();
                Item item = iter.next();
                if (item == null) {
                    return null;
                }
                listener.startCurrentItem(item);
                TailCall tc = ((TailCallReturner)action).processLeavingTail(c2);
                listener.endCurrentItem(item);
                return tc;
             
            } else {
              Item item = iter.next();
              if (item == null) {
                  return null;
              }
            }
            return ((TailCallReturner)action).processLeavingTail(c2);
        } else {
            if (LogConfiguration.loggingIsEnabled() && LogController.traceIsEnabled()) {
                TraceListener listener = LogController.getTraceListener();
                while(true) {
                    Item item = iter.next();
                    if (item == null) {
                        break;
                    }
                    listener.startCurrentItem(item);
                    action.process(c2);
                    listener.endCurrentItem(item);
                }
            } else {
              while(true) {
                  Item item = iter.next();
                  if (item == null) {
                      break;
                  }
                  action.process(c2);
              }
View Full Code Here

        PipelineConfiguration pipe = controller.makePipelineConfiguration();
        seq.setPipelineConfiguration(pipe);
        c2.setTemporaryReceiver(seq);
        process(c2);
        seq.close();
        Item item = seq.getFirstItem();
        seq.reset();
        return item;
    }
View Full Code Here

    /**
     * Evaluate as an Item. This should only be called if the UntypedAtomicConverter has cardinality zero-or-one
     */

    public Item evaluateItem(XPathContext context) throws XPathException {
        Item item = operand.evaluateItem(context);
        if (item == null) {
            return null;
        }
        if (item instanceof UntypedAtomicValue) {
            ConversionResult val = ((UntypedAtomicValue)item).convert(requiredItemType, true);
View Full Code Here

        result = new ContextMappingIterator(this, context2);

        // Peek at the first item, and depending on its type, check that all the items
        // are atomic values or that all are nodes.
        final SourceLocator loc = getSourceLocator();
        Item first = result.next();
        if (first == null) {
            return EmptyIterator.getInstance();
        } else if (first instanceof AtomicValue) {
            ItemMappingFunction atomicValueChecker = new ItemMappingFunction() {
                public Item mapItem(Item item) throws XPathException {
View Full Code Here

                textValue = constantText;
            } else {
                FastStringBuffer sb = new FastStringBuffer(FastStringBuffer.SMALL);
                SequenceIterator iter = content.iterate(context);
                while (true) {
                    Item item = iter.next();
                    if (item==null) break;
                    sb.append(item.getStringValueCS());
                }
                textValue = sb.condense();
            }
            root = new TextFragmentValue(textValue, getBaseURI());
            ((TextFragmentValue)root).setConfiguration(controller.getConfiguration());
View Full Code Here

TOP

Related Classes of client.net.sf.saxon.ce.om.Item

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.