Package client.net.sf.saxon.ce.value

Examples of client.net.sf.saxon.ce.value.StringValue


     * @throws XPathException if a failure occurs evaluating the arguments
     */

    public Item evaluateItem(XPathContext context) throws XPathException {
        NodeInfo element = (NodeInfo)argument[1].evaluateItem(context);
        StringValue p = (StringValue)argument[0].evaluateItem(context);
        String prefix;
        if (p == null) {
            prefix = "";
        } else {
            prefix = p.getStringValue();
        }
        NamespaceResolver resolver = new InscopeNamespaceResolver(element);
        String uri = resolver.getURIForPrefix(prefix, true);
        if (uri == null) {
            return null;
View Full Code Here


    public CharSequence evaluateAsString(XPathContext context) throws XPathException {
        Item o = evaluateItem(context);
//        if (o instanceof AtomicValue && !((AtomicValue)o).hasBuiltInType()) {
//            o = ((AtomicValue) o).getPrimitiveValue();
//        }
        StringValue value = (StringValue) o;  // the ClassCastException is deliberate
        if (value == null) return "";
        return value.getStringValue();
    }
View Full Code Here

    @SuppressWarnings("rawtypes")
  public static SequenceIterator convertFromJavaScript(Object jsValue, Configuration config) {
        if (jsValue == null) {
            return EmptyIterator.getInstance();
        } else if (jsValue instanceof String) {
            return SingletonIterator.makeIterator(new StringValue((String)jsValue));
        } else if (jsValue instanceof Double) {
            return SingletonIterator.makeIterator(new DoubleValue((Double)jsValue));
        } else if (jsValue instanceof Boolean) {
            return SingletonIterator.makeIterator(BooleanValue.get((Boolean)jsValue));
        } else if (!(jsValue instanceof JavaScriptObject)) {
View Full Code Here

        if (a == null) {
            return (b == null ? 0 : -1);
        } else if (b == null) {
            return +1;
        }
        StringValue as = (StringValue)a;
        StringValue bs = (StringValue)b;
        if (as.containsSurrogatePairs() || bs.containsSurrogatePairs()) {
            return collator.compareCS(as.getStringValueCS(), bs.getStringValueCS());
        } else {
            // optimize to use UTF-16 binary comparison
            return as.getStringValue().compareTo(bs.getStringValue());
        }
    }
View Full Code Here

    * @return <0 if a<b, 0 if a=b, >0 if a>b
    * @throws ClassCastException if either value is not xs:string or a subtype
    */

    public boolean comparesEqual(AtomicValue a, AtomicValue b) {
        StringValue as = (StringValue)a;
        StringValue bs = (StringValue)b;
        return as.codepointEquals(bs);
    }
View Full Code Here

    * function, and vice versa. There is no requirement that the
    * comparison keys should reflect the ordering of the underlying objects.
    */

    public ComparisonKey getComparisonKey(AtomicValue a) {
        StringValue as = (StringValue)a;
        return new ComparisonKey(StandardNames.XS_STRING, as.getStringValue());
    }
View Full Code Here

    private StringValue toStringValue(AtomicValue a) {
        if (a instanceof StringValue) {
            return ((StringValue)a);
        } else {
            return new StringValue((a == null ? "" : a.getStringValue()));
        }
    }
View Full Code Here

        // If either operand is a string, or if both are untyped atomic, convert
        // both operands to strings and compare them

        if (t0.equals(BuiltInAtomicType.STRING) || t1.equals(BuiltInAtomicType.STRING) ||
                (t0.equals(BuiltInAtomicType.UNTYPED_ATOMIC) && t1.equals(BuiltInAtomicType.UNTYPED_ATOMIC))) {
            StringValue s0 = (StringValue)a0.convert(BuiltInAtomicType.STRING, true).asAtomic();
            StringValue s1 = (StringValue)a1.convert(BuiltInAtomicType.STRING, true).asAtomic();
            return ValueComparison.compare(s0, operator, s1, comparer, false);
        }

        // If either operand is untyped atomic,
        // convert it to the type of the other operand, and compare
View Full Code Here

     * @throws XPathException
     */

    private StringCollator getCollator(XPathContext context) throws XPathException {
        if (collationNameExpression != null) {
            StringValue collationValue = (StringValue)collationNameExpression.evaluateItem(context);
            String cname = collationValue.getStringValue();
            URI collationURI;
            try {
                collationURI = new URI(cname, true);
                if (!collationURI.isAbsolute()) {
                    if (baseURI == null) {
View Full Code Here

     * Get the typed value of this node.
     * Returns the string value, as an instance of xs:string
     */

    public AtomicValue getTypedValue() {
        return new StringValue(getStringValue());
    }
View Full Code Here

TOP

Related Classes of client.net.sf.saxon.ce.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.