Package org.pdf4j.saxon.om

Examples of org.pdf4j.saxon.om.Item


    public Item evaluateItem(XPathContext context) throws XPathException {
        Controller controller = context.getController();
        if (controller.isTracing()) {
            controller.getTraceListener().enter(getInstructionInfo(), context);
        }
        Item result = child.evaluateItem(context);
        if (controller.isTracing()) {
            controller.getTraceListener().leave(getInstructionInfo());
        }
        return result;
    }
View Full Code Here


        } else {
            NodeInfo source;
            if (select != null) {
                source = (NodeInfo) select.evaluateItem(context);
            } else {
                Item item = context.getContextItem();
                if (!(item instanceof NodeInfo)) {
                    XPathException err = new XPathException("context item for xsl:number must be a node");
                    err.setErrorCode("XTTE0990");
                    err.setIsTypeError(true);
                    err.setXPathContext(context);
View Full Code Here

     * @throws XPathException
     */
    public TailCall processLeavingTail(XPathContext context) throws XPathException {
        // TODO: allow the output of value-of to be streamed to the serializer
        SequenceReceiver out = context.getReceiver();
        Item item = select.evaluateItem(context);
        if (item != null) {
            out.characters(item.getStringValueCS(), locationId, options);
        }
        return null;
    }
View Full Code Here

     */

    public Item evaluateItem(XPathContext context) throws XPathException {
        try {
            CharSequence val;
            Item item = select.evaluateItem(context);
            if (item == null) {
                if (noNodeIfEmpty) {
                    return null;
                } else {
                    val = "";
                }
            } else {
                val = item.getStringValueCS();
            }
            Orphan o = new Orphan(context.getController().getConfiguration());
            o.setNodeKind(Type.TEXT);
            o.setStringValue(val);
            return o;
View Full Code Here

    * as a string. The expansion must not generate any element or attribute nodes.
    * @param context The dynamic context for the transformation
    */

    public CharSequence expandChildren(XPathContext context) throws XPathException {
        Item item = select.evaluateItem(context);
        if (item==null) {
            return (noNodeIfEmpty ? null : "");
        } else {
            return item.getStringValueCS();
        }
    }
View Full Code Here

    public Item evaluateItem(XPathContext context) throws XPathException {

        if (isSingleton && isAtomic) {
            // optimize for this case
            Item item = select.evaluateItem(context);
            if (item == null) {
                if (noNodeIfEmpty) {
                    return null;
                } else {
                    return StringValue.EMPTY_STRING;
                }
            }
            if (item instanceof StringValue) {
                return item;
            } else {
                return ((AtomicValue)item).convert(BuiltInAtomicType.STRING, true, context).asAtomic();
            }
        }
        SequenceIterator iter = select.iterate(context);
        if (!isAtomic) {
            iter = Atomizer.getAtomizingIterator(iter);
        }
        FastStringBuffer sb = new FastStringBuffer(1024);
        boolean first = true;
        String sep = " ";
        while (true) {
            Item item = iter.next();
            if (item==null) {
                break;
            }
            if (!first) {
                sb.append(sep);
            }
            first = false;
            sb.append(item.getStringValueCS());
        }
        if (first && noNodeIfEmpty) {
            return null;
        }
        return StringValue.makeStringValue(sb.condense());
View Full Code Here

        }
    }

    private boolean docAvailable(String href, XPathContext context) throws URISyntaxException {
        try {
            Item item = Document.makeDoc(href, expressionBaseURI, context, this);
            return item != null;
        } catch (Exception err) {
            try {
                new URI(href);
            } catch (URISyntaxException e2) {
View Full Code Here

            pipe.setHostLanguage(getHostLanguage());
            seq.setPipelineConfiguration(pipe);
            c2.setTemporaryReceiver(seq);
            process(c2);
            seq.close();
            Item result = seq.getFirstItem();
            seq.reset();
            return result;
        }
    }
View Full Code Here

     */

    public SequenceIterator iterate(XPathContext context) throws XPathException {
        int m = getImplementationMethod();
        if ((m & EVALUATE_METHOD) != 0) {
            Item item = evaluateItem(context);
            if (item==null) {
                return EmptyIterator.getInstance();
            } else {
                return SingletonIterator.makeIterator(item);
            }
View Full Code Here

     *     The expression must return a string or (); if the value of the
     *     expression is (), this method returns "".
     */

    public final CharSequence evaluateAsString(XPathContext context) throws XPathException {
        Item item = evaluateItem(context);
        if (item==null) {
            return "";
        } else {
            return item.getStringValue();
        }
    }
View Full Code Here

TOP

Related Classes of org.pdf4j.saxon.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.