Package client.net.sf.saxon.ce.tree.util

Examples of client.net.sf.saxon.ce.tree.util.URI


        if (expressionBaseURI == null) {
            String base = null;
            try {
                base = env.getBaseURI();
                if (base != null) {
                    expressionBaseURI = new URI(base);
                }
            } catch (URI.URISyntaxException e) {
                // perhaps escaping special characters will fix the problem

                String esc = EscapeURI.iriToUri(base).toString();
                try {
                    expressionBaseURI = new URI(esc);
                } catch (URI.URISyntaxException e2) {
                    // don't fail unless the base URI is actually needed (it usually isn't)
                    expressionBaseURI = null;
                }
View Full Code Here


            final Expression collationExp = argument[getNumberOfArguments() - 1];
            final Value collationVal = (collationExp instanceof Literal ? ((Literal)collationExp).getValue() : null);
            if (collationVal instanceof AtomicValue) {
                // Collation is supplied as a constant
                String collationName = collationVal.getStringValue();
                URI collationURI;
                try {
                    collationURI = new URI(collationName, true);
                    if (!collationURI.isAbsolute()) {
                        saveBaseURI(env, true);
                        if (expressionBaseURI == null) {
                            XPathException err = new XPathException("The collation name is a relative URI, but the base URI is unknown");
                            err.setErrorCode("XPST0001");
                            err.setIsStaticError(true);
                            err.setLocator(this.getSourceLocator());
                            throw err;
                        }
                        URI base = expressionBaseURI;
                        collationURI = base.resolve(collationURI.toString());
                        collationName = collationURI.toString();
                    }
                } catch (URI.URISyntaxException e) {
                    XPathException err = new XPathException("Collation name '" + collationName + "' is not a valid URI");
                    err.setErrorCode("FOCH0002");
View Full Code Here

            int numargs = argument.length;
            if (numargs > arg) {
                AtomicValue av = (AtomicValue) argument[arg].evaluateItem(context);
                StringValue collationValue = (StringValue) av;
                String collationName = collationValue.getStringValue();
                URI collationURI;
                try {
                    collationURI = new URI(collationName, true);
                    if (!collationURI.isAbsolute()) {
                        if (expressionBaseURI == null) {
                            XPathException err = new XPathException("Cannot resolve relative collation URI '" + collationName +
                                    "': unknown or invalid base URI");
                            err.setErrorCode("FOCH0002");
                            err.setXPathContext(context);
                            err.setLocator(this.getSourceLocator());
                            throw err;
                        }
                        collationURI = expressionBaseURI.resolve(collationURI.toString());
                        collationName = collationURI.toString();
                    }
                } catch (URI.URISyntaxException e) {
                    XPathException err = new XPathException("Collation name '" + collationName + "' is not a valid URI");
                    err.setErrorCode("FOCH0002");
                    err.setXPathContext(context);
View Full Code Here

        StringCollator stringCollator = null;
        if (collationName instanceof StringLiteral) {
            String collationString = ((StringLiteral)collationName).getStringValue();
            try {
                URI collationURI = new URI(collationString, true);
                if (!collationURI.isAbsolute()) {
                    URI base = new URI(getBaseURI());
                    collationURI = base.resolve(collationURI.toString());
                    collationString = collationURI.toString();
                }
            } catch (URI.URISyntaxException err) {
                compileError("Collation name '" + collationString + "' is not a valid URI");
                collationString = NamespaceConstant.CODEPOINT_COLLATION_URI;
View Full Code Here

        if (use != null) {
            use = makeExpressionVisitor().typeCheck(use, match.getNodeTest());
        }

        if (collationName != null) {
            URI collationURI;
            try {
                collationURI = new URI(collationName, true);
                if (!collationURI.isAbsolute()) {
                    URI base = new URI(getBaseURI());
                    collationURI = base.resolve(collationURI.toString());
                    collationName = collationURI.toString();
                }
            } catch (URI.URISyntaxException err) {
                compileError("Collation name '" + collationName + "' is not a valid URI");
                //collationName = NamespaceConstant.CODEPOINT_COLLATION_URI;
View Full Code Here

        // from a validate{} expression, so until it does, we might as well use the same logic.
        String newBaseUri;
        String xmlBase = Navigator.getAttributeValue(source, NamespaceConstant.XML, "base");
        if (xmlBase != null) {
            try {
                URI xmlBaseUri = new URI(xmlBase, true);
                if (xmlBaseUri.isAbsolute()) {
                    newBaseUri = xmlBase;
                } else if (staticBaseUri != null) {
                    URI sbu = new URI(staticBaseUri);
                    URI abs = sbu.resolve(xmlBaseUri.toString());
                    newBaseUri = abs.toString();
                } else {
                    newBaseUri = source.getBaseURI();
                }
            } catch (URI.URISyntaxException err) {
                newBaseUri = source.getBaseURI();
View Full Code Here

                    relative = relative.substring(0, hash);
                }

                String source;
                try {
                    URI base = new URI(getBaseURI());
                    URI abs = base.resolve(relative);
                    source = abs.toString();
                } catch (URI.URISyntaxException e) {
                    throw new XPathException(e);
                }

                // check for recursion
View Full Code Here

                sortKeys[i].setSortKey(sortKey);
            }
        }
        if (collator == null && (collationNameExpression instanceof StringLiteral)) {
            String collation = ((StringLiteral)collationNameExpression).getStringValue();
            URI collationURI;
            try {
                collationURI = new URI(collation, true);
                if (!collationURI.isAbsolute()) {
                    URI base = new URI(baseURI);
                    collationURI = base.resolve(collationURI.toString());
                    final String collationNameString = collationURI.toString();
                    collationNameExpression = new StringLiteral(collationNameString);
                    collator = visitor.getConfiguration().getNamedCollation(collationNameString);
                    if (collator == null) {
                        dynamicError("Unknown collation " + Err.wrap(collationURI.toString(), Err.URI), "XTDE1110", null);
View Full Code Here

    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) {
                        dynamicError("Cannot resolve relative collation URI '" + cname +
                                "': unknown or invalid base URI", "XTDE1110", context);
                    }
                    collationURI = new URI(baseURI).resolve(collationURI.toString());
                    cname = collationURI.toString();
                }
            } catch (URI.URISyntaxException e) {
                dynamicError("Collation name '" + cname + "' is not a valid URI", "XTDE1110", context);
            }
            return context.getConfiguration().getNamedCollation(cname);
View Full Code Here

                compileError("A collation may be specified only if group-by or group-adjacent is specified", "XTSE1090");
            } else {
                collationName = makeAttributeValueTemplate(collationAtt);
                if (collationName instanceof StringLiteral) {
                    String collation = ((StringLiteral)collationName).getStringValue();
                    URI collationURI;
                    try {
                        collationURI = new URI(collation, true);
                        if (!collationURI.isAbsolute()) {
                            URI base = new URI(getBaseURI());
                            collationURI = base.resolve(collationURI.toString());
                            collationName = new StringLiteral(collationURI.toString());
                        }
                    } catch (URI.URISyntaxException err) {
                        compileError("Collation name '" + collationName + "' is not a valid URI", "XTDE1110");
                        collationName = new StringLiteral(NamespaceConstant.CODEPOINT_COLLATION_URI);
View Full Code Here

TOP

Related Classes of client.net.sf.saxon.ce.tree.util.URI

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.