Package net.sf.saxon.value

Examples of net.sf.saxon.value.StringValue


        } else {
            if (separator == null) {
                if (select == null) {
                    separator = StringValue.EMPTY_STRING;
                } else {
                    separator = new StringValue(" ");
                }
            }
        }
        ValueOf inst = new ValueOf(select, disable);
        compileContent(exec, inst);
View Full Code Here


    /**
    * Evaluate in a general context
    */

    public Item evaluateItem(XPathContext c) throws XPathException {
        return new StringValue(evaluateAsString(c));
    }
View Full Code Here

    /**
    * Compile time evaluation
    */

    public Expression preEvaluate(StaticContext env) throws XPathException {
        return new StringValue(env.getBaseURI());
    }
View Full Code Here

            dynamicError("Relative URI " + Err.wrap(relative) + " is invalid: " + err.getMessage(),
                    "FORG0002", context);
            return null;
        }
        if (relativeURI.isAbsolute()) {
            return new StringValue(relative);
        }

        String base;
        URI baseURI;
        if (argument.length == 2) {
            base = argument[1].evaluateAsString(context);
        } else {
            base = expressionBaseURI;
            if (expressionBaseURI == null) {
                dynamicError("Base URI in static context is unknown",
                        "FONS0005", context);
                return null;
            }
        }
        try {
            baseURI = new URI(base);
        } catch (URISyntaxException err) {
            dynamicError("Base URI " + Err.wrap(base) + " is invalid: " + err.getMessage(),
                    "FORG0002", context);
            return null;
        }
        if (!baseURI.isAbsolute()) {
            dynamicError("Base URI " + Err.wrap(base) + " is not an absolute URI",
                    "FORG0009", context);
            return null;
        }
        URI resolvedURI = baseURI.resolve(relativeURI);
        return new StringValue(resolvedURI.toString());
    }
View Full Code Here

        } else {
            select = makeExpression(selectAtt);
        }

        if (orderAtt == null) {
            order = new StringValue("ascending");
        } else {
            order = makeAttributeValueTemplate(orderAtt);
        }

        if (dataTypeAtt == null) {
            dataType = EmptySequence.getInstance();
        } else {
            dataType = makeAttributeValueTemplate(dataTypeAtt);
        }

        if (caseOrderAtt == null) {
            caseOrder = new StringValue("#default");
        } else {
            caseOrder = makeAttributeValueTemplate(caseOrderAtt);
        }

        if (langAtt == null) {
            lang = new StringValue(Locale.getDefault().getLanguage());
        } else {
            lang = makeAttributeValueTemplate(langAtt);
        }

        collationName = collationAtt;
View Full Code Here

                case ENDSWITH:
                    return BooleanValue.get(s0.endsWith(s1));
                case AFTER:
                    int i = s0.indexOf(s1);
                    if (i<0) return StringValue.EMPTY_STRING;
                    return new StringValue(s0.substring(i+s1.length()));
                case BEFORE:
                    int j = s0.indexOf(s1);
                    if (j<0) return StringValue.EMPTY_STRING;
                    return new StringValue(s0.substring(0, j));
                default:
                    throw new UnsupportedOperationException("Unknown operation " + operation);
            }
        } else {

            if (!(collator instanceof RuleBasedCollator)) {
                dynamicError("The collation for " + getDisplayName(context.getController().getNamePool()) +
                        " must be a RuleBaseCollator", context);
                return null;
            }
            RuleBasedCollator rbc = (RuleBasedCollator)collator;
            CollationElementIterator iter0 = rbc.getCollationElementIterator(s0);
            CollationElementIterator iter1 = rbc.getCollationElementIterator(s1);

            switch (operation) {
                case STARTSWITH:
                    return BooleanValue.get( collationStartsWith(iter0, iter1) );
                case CONTAINS:
                case ENDSWITH:
                    return BooleanValue.get( collationContains(iter0, iter1, null) );
                case AFTER:
                    int[] ia = new int[2];
                    boolean ba = collationContains(iter0, iter1, ia);
                    if (ba) {
                        return new StringValue(s0.substring(ia[1]));
                    } else {
                        return StringValue.EMPTY_STRING;
                    }
                case BEFORE:
                    int[] ib = new int[2];
                    boolean bb = collationContains(iter0, iter1, ib);
                    if (bb) {
                        return new StringValue(s0.substring(0, ib[0]));
                    } else {
                        return StringValue.EMPTY_STRING;
                    }
                default:
                    throw new UnsupportedOperationException("Unknown operation " + operation);
View Full Code Here

            }
        } else if (nameValue instanceof QNameValue && allowNameAsQName) {
            // this is allowed in XQuery
            localName = ((QNameValue)nameValue).getLocalName();
            uri = ((QNameValue)nameValue).getNamespaceURI();
            namespace = new StringValue(uri);
            // we need to allocate a prefix. Any one will do; if it's a duplicate,
            // a different one will be substituted
            prefix = pool.suggestPrefixForURI(uri);
            if (prefix == null) {
                prefix = "nsq0";
View Full Code Here

            dynamicError("In function " + getDisplayName(context.getController().getNamePool()) +
                            ", the context node must be in a tree whose root is a document node", code, context);
        }
        String[] ids = ((DocumentInfo)doc).getUnparsedEntity(arg0);
        if (ids==null) return StringValue.EMPTY_STRING;
        return new StringValue(ids[operation]);
    }
View Full Code Here

                                               null);
            SequenceReceiver out = c2.getReceiver();
            out.open();
            node.copy(out, NodeInfo.ALL_NAMESPACES, true, locationId);
            out.close();
            return new StringValue(result.toString());
        } catch (XPathException err) {
            throw new DynamicError(err);
        }
    }
View Full Code Here

    /**
    * Evaluate in a general context
    */

    public Item evaluateItem(XPathContext c) throws XPathException {
        return new StringValue(evaluateAsString(c));
    }
View Full Code Here

TOP

Related Classes of net.sf.saxon.value.StringValue

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.