Package org.pdf4j.saxon.trans

Examples of org.pdf4j.saxon.trans.XPathException


    }

    private static void explain(Configuration config, String message, int flags) {
        try {
            if ((flags & WARNING_IF_FALSE) != 0) {
                config.getErrorListener().warning(new XPathException("deep-equal(): " + message));
            }
        } catch (TransformerException e) {
            //
        }
    }
View Full Code Here



    private String evaluatePrefix(XPathContext context) throws XPathException {
        String prefix = Whitespace.trim(name.evaluateAsString(context));
        if (!(prefix.length() == 0 || context.getConfiguration().getNameChecker().isValidNCName(prefix))) {
            XPathException err = new XPathException("Namespace prefix is invalid: " + prefix, this);
            err.setErrorCode("XTDE0920");
            err.setXPathContext(context);
            throw dynamicError(this, err, context);
        }

        if (prefix.equals("xmlns")) {
            XPathException err = new XPathException("Namespace prefix 'xmlns' is not allowed", this);
            err.setErrorCode("XTDE0920");
            err.setXPathContext(context);
            throw dynamicError(this, err, context);
        }
        return prefix;
    }
View Full Code Here

        return node;
    }

    private void checkPrefixAndUri(String prefix, String uri, XPathContext context) throws XPathException {
        if (prefix.equals("xml") != uri.equals(NamespaceConstant.XML)) {
            XPathException err = new XPathException("Namespace prefix 'xml' and namespace uri " + NamespaceConstant.XML +
                    " must only be used together", this);
            err.setErrorCode("XTDE0925");
            err.setXPathContext(context);
            throw dynamicError(this, err, context);
        }

        if (uri.length() == 0) {
            XPathException err = new XPathException("Namespace URI is an empty string", this);
            err.setErrorCode("XTDE0930");
            err.setXPathContext(context);
            //context.getController().recoverableError(err);
            throw dynamicError(this, err, context);
        }

        if (!AnyURIValue.isValidURI(uri)) {
            XPathException de = new XPathException("The string value of the constructed namespace node must be a valid URI");
            de.setErrorCode("XTDE0905");
            de.setXPathContext(context);
            de.setLocator(this);
            throw de;
        }
    }
View Full Code Here

            if (versionProperty.equals("4.0") || versionProperty.equals("4.01")) {
                version = 4;
            } else if (versionProperty.equals("5.0")) {
                version = 5;
            } else {
                XPathException err = new XPathException("Unsupported HTML version: " + versionProperty);
                err.setErrorCode("SESU0013");
                throw err;
            }
        }

        String byteOrderMark = outputProperties.getProperty(SaxonOutputKeys.BYTE_ORDER_MARK);
View Full Code Here

    protected void writeDocType(String type, String systemId, String publicId) throws XPathException {
        if (version == 5) {
            try {
                writer.write("<!DOCTYPE HTML>\n");
            } catch (java.io.IOException err) {
                throw new XPathException(err);
            }
        } else {
            super.writeDocType(type, systemId, publicId);
        }
    }
View Full Code Here

                    return;
                }
            }
            super.writeAttribute(elCode, attname, value, properties);
        } catch (java.io.IOException err) {
            throw new XPathException(err);
        }
    }
View Full Code Here

            // always output NBSP as an entity reference
              writer.write("&nbsp;");

            } else if (c>=127 && c<160) {
                // these control characters are illegal in HTML
                XPathException err = new XPathException("Illegal HTML character: decimal " + (int)c);
                err.setErrorCode("SERE0014");
                throw err;

            } else if (c>=55296 && c<=56319) {  //handle surrogate pair

                //A surrogate pair is two consecutive Unicode characters.  The first
View Full Code Here

        if (empty) {
            openDocument();
        }
        for (int i=0; i<data.length(); i++) {
            if (data.charAt(i) == '>') {
                XPathException err = new XPathException("A processing instruction in HTML must not contain a > character");
                err.setErrorCode("SERE0015");
                throw err;
            }
        }
        try {
            writer.write("<?");
            writer.write(target);
            writer.write(' ');
            writeCharSequence(data);
            writer.write('>');
        } catch (java.io.IOException err) {
            throw new XPathException(err);
        }
    }
View Full Code Here

        return this;
    }

    public Expression typeCheck(ExpressionVisitor visitor, ItemType contextItemType) throws XPathException {
        if (contextItemType == null) {
            XPathException err = new XPathException("The context for position() is undefined");
            err.setErrorCode("XPDY0002");
            err.setIsTypeError(true);
            err.setLocator(this);
            throw err;
        }
        return super.typeCheck(visitor, contextItemType);
    }
View Full Code Here

            } else if (key.equals(SUPPLY_SOURCE_LOCATOR)) {
                if (value != null) {
                    checkYesOrNo(key, value);
                }
            } else {
                throw new XPathException("Unknown serialization parameter " + Err.wrap(key));
            }
        } else {
            //return;
        }
    }
View Full Code Here

TOP

Related Classes of org.pdf4j.saxon.trans.XPathException

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.