Package org.pdf4j.saxon

Examples of org.pdf4j.saxon.Platform


                sv = (AtomicValue)argument[2].evaluateItem(c);
                flags = sv.getStringValueCS();
            }

            try {
                final Platform platform = Configuration.getPlatform();
                final int xmlVersion = c.getConfiguration().getXMLVersion();
                re = platform.compileRegularExpression(
                        pattern, xmlVersion, RegularExpression.XPATH_SYNTAX, flags);
            } catch (XPathException err) {
                XPathException de = new XPathException(err);
                de.setErrorCode("FORX0002");
                de.setXPathContext(c);
View Full Code Here


    public void applyModuleImport(Import mImport) throws XPathException {
        boolean foundOne = false;

        // resolve the location URIs against the base URI
        Platform platform = Configuration.getPlatform();
        for (int i=0; i<mImport.locationURIs.size(); i++) {
            try {
                String uri = (String)mImport.locationURIs.get(i);
                URI abs = platform.makeAbsolute(uri, env.getBaseURI());
                mImport.locationURIs.set(i, abs);
            } catch (URISyntaxException e) {
                grumble("Invalid URI " + mImport.locationURIs.get(i) + ": " + e.getMessage());
            }
        }
View Full Code Here

        final Configuration config = context.getConfiguration();
        NameChecker checker = config.getNameChecker();

        // Use the URI machinery to validate and resolve the URIs

        Platform platform = Configuration.getPlatform();
        URI absoluteURI;
        try {
            absoluteURI = platform.makeAbsolute(href, baseURI);
        } catch (java.net.URISyntaxException err) {
            XPathException e = new XPathException(err.getReason() + ": " + err.getInput(), err);
            e.setErrorCode("XTDE1170");
            throw e;
        }
View Full Code Here

                if (sv2==null) return null;
                flags = sv2.getStringValueCS();
            }

            try {
                final Platform platform = Configuration.getPlatform();
                final int xmlVersion = c.getConfiguration().getXMLVersion();
                re = platform.compileRegularExpression(
                        pat.getStringValueCS(), xmlVersion, RegularExpression.XPATH_SYNTAX, flags);
            } catch (XPathException err) {
                XPathException de = new XPathException(err);
                if (de.getErrorCodeLocalPart() == null) {
                    de.setErrorCode("FORX0002");
View Full Code Here

            flagstr = ((StringLiteral)args[flagsArg]).getStringValue();
        }

        if (args[patternArg] instanceof StringLiteral && flagstr != null) {
            try {
                Platform platform = Configuration.getPlatform();
                String in = ((StringLiteral)args[patternArg]).getStringValue();
                final int xmlVersion = env.getConfiguration().getXMLVersion();
                int syntax = RegularExpression.XPATH_SYNTAX;
                // TODO: Find a better (conformant) way of switching this option on
                if (flagstr.length() > 0 && flagstr.charAt(0) == '!') {
                    flagstr = flagstr.subSequence(1, flagstr.length());
                    syntax = RegularExpression.NATIVE_SYNTAX;
                }
                return platform.compileRegularExpression(in, xmlVersion, syntax, flagstr);
            } catch (XPathException err) {
                if (err.getErrorCodeLocalPart() == null) {
                    err.setErrorCode("FORX0002");
                }
                throw err;
View Full Code Here

        }
        flags = makeAttributeValueTemplate(flagsAtt);

        if (regex instanceof StringLiteral && flags instanceof StringLiteral) {
            try {
                final Platform platform = Configuration.getPlatform();
                final CharSequence regex = ((StringLiteral)this.regex).getStringValue();
                final CharSequence flagstr = ((StringLiteral)flags).getStringValue();
                final int xmlVersion = getConfiguration().getXMLVersion();
                pattern = platform.compileRegularExpression(
                        regex, xmlVersion, RegularExpression.XPATH_SYNTAX, flagstr);

                if (pattern.matches("")) {
                    invalidRegex("The regular expression must not be one that matches a zero-length string", "XTDE1150");
                }
View Full Code Here

                AtomicValue arg3 = (AtomicValue)argument[3].evaluateItem(c);
                flags = arg3.getStringValueCS();
            }

            try {
                final Platform platform = Configuration.getPlatform();
                final int xmlVersion = c.getConfiguration().getXMLVersion();
                re = platform.compileRegularExpression(
                        arg1.getStringValueCS(), xmlVersion, RegularExpression.XPATH_SYNTAX, flags);
            } catch (XPathException err) {
                XPathException de = new XPathException(err);
                de.setErrorCode("FORX0002");
                de.setXPathContext(c);
View Full Code Here

            err.setErrorCode("XQST0059");
            err.setIsStaticError(true);
            throw err;
        } else {
            // One or more locations given: import modules from all these locations
            Platform platform = Configuration.getPlatform();
            StreamSource[] sources = new StreamSource[locations.length];
            for (int m=0; m<locations.length; m++) {
                String href = locations[m];
                URI absoluteURI;
                try {
                    absoluteURI = platform.makeAbsolute(href, baseURI);
                } catch (URISyntaxException err) {
                    XPathException se = new XPathException("Cannot resolve relative URI " + href, err);
                    se.setErrorCode("XQST0059");
                    se.setIsStaticError(true);
                    throw se;
View Full Code Here

        if (kind != Type.ELEMENT && kind != Type.DOCUMENT) {
            dynamicError("Node in put() must be a document or element node",
                    "FOUP0001", context);
        }
        String relative = argument[1].evaluateItem(context).getStringValue();
        Platform platform = Configuration.getPlatform();
        String abs;
        try {
            URI resolved = platform.makeAbsolute(relative,  expressionBaseURI);
            abs = resolved.toString();
        } catch (URISyntaxException err) {
            dynamicError("Base URI " + Err.wrap(expressionBaseURI) + " is invalid: " + err.getMessage(),
                    "FOUP0002", context);
            abs = null;
View Full Code Here

            relative = new URI(relativeURI);
        } catch (URISyntaxException err) {
            throw new XPathException("Invalid relative URI " + Err.wrap(relativeURI), err);
        }

        Platform platform = JavaPlatform.getInstance();

        try {
            url = platform.makeAbsolute(relativeURI, base);
        } catch (URISyntaxException err) {
            // System.err.println("Recovering from " + err);
            // last resort: if the base URI is null, or is itself a relative URI, we
            // try to expand it relative to the current working directory
            String expandedBase = ResolveURI.tryToExpand(base);
View Full Code Here

TOP

Related Classes of org.pdf4j.saxon.Platform

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.