Package net.sf.saxon.value

Examples of net.sf.saxon.value.StringValue


    * Map a namespace node to its name (the namespace prefix)
    */

    public Object map(Item item, XPathContext context, Object info) throws XPathException {
        NodeInfo nsNode = (NodeInfo)item;
        return new StringValue(nsNode.getLocalPart());
    }
View Full Code Here


    public Item evaluateItem(XPathContext c) throws XPathException {
        switch (operation) {
        case TO_CODEPOINTS:
            throw new UnsupportedOperationException("Cannot call evaluateItem on a sequence");
        case FROM_CODEPOINTS:
            return new StringValue(unicodeToString(argument[0].iterate(c), c));
        default:
            throw new UnsupportedOperationException("Unknown Unicode operation");
        }
    }
View Full Code Here

    * Return a sequence of integers representing the Unicode code values of the characters in a given
    * string.
    */

    private static SequenceIterator stringToUnicode(String s) {
        return new StringValue(s).iterateCharacters();
    }
View Full Code Here

        SimpleType base = getItemType();
        SequenceIterator iter = new StringTokenIterator(value.toString());
        int count = 0;
        try {
            while (true) {
                StringValue val = (StringValue)iter.next();
                if (val == null) break;
                base.validateContent(val.getStringValue(), nsResolver);
                count++;
            }
            Iterator fi = getFacets();
            while (fi.hasNext()) {
                Facet f = (Facet)fi.next();
                if (!f.testLength(count)) {
                    throw new ValidationException(
                            "Length of list (" + count + ") violates " +
                            f.getName() + " facet " + Err.wrap(f.getValue()));

                }
                if (f.appliesToWholeList()) {
                    boolean match = f.testAtomicValue(new StringValue(NormalizeSpace.normalize(value.toString())));
                    if (!match) {
                        throw new ValidationException(
                            "List " + Err.wrap(value) + " violates the " + f.getName() + " facet " +
                            Err.wrap(f.getValue()));
                    }
View Full Code Here

    * Pre-evaluate the function
    */

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

            if (prefix.equals("")) {
                uri = "";
            } else {
                uri = env.getURIForPrefix(prefix);
            }
            return new StringValue(getProperty(uri, lname, env.getConfiguration()));
        } catch (QNameException e) {
            throw new StaticError("Invalid system property name. " + e.getMessage());
        }
    }
View Full Code Here

            if (prefix.equals("")) {
                uri = "";
            } else {
                uri = nsContext.getURIForPrefix(prefix, false);
            }
            return new StringValue(getProperty(uri, lname, context.getController().getConfiguration()));
        } catch (QNameException e) {
            dynamicError("Invalid system property name. " + e.getMessage(), "XT1390", context);
            return null;
        }
    }
View Full Code Here

    public Item next() {
        if (tokenizer.hasMoreElements()) {
            current = (String)tokenizer.nextElement();
            position++;
            return new StringValue(current);
        } else {
            return null;
        }
    }
View Full Code Here

            return null;
        }
    }

    public Item current() {
        return new StringValue(current);
    }
View Full Code Here

        } else if (source instanceof Float) {
            result = new FloatValue((Float)source);
        } else if (source instanceof BigDecimal) {
            result = new DecimalValue((BigDecimal)source);
        } else if (source instanceof String) {
            result = new StringValue(((String)source));
        } else {
            result = new ObjectValue(source);
        }

        return result;
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.