Package client.net.sf.saxon.ce.trans

Examples of client.net.sf.saxon.ce.trans.XPathException


    @Override
    public int intValue() throws XPathException {
        if (getDecimalValue().compareTo(BIG_DECIMAL_MIN_INT) < 0 ||
               getDecimalValue().compareTo(BIG_DECIMAL_MAX_INT) > 0 ) {
            throw new XPathException("int out of range");
        } else {
            return getDecimalValue().intValue();
        }
    }
View Full Code Here


     * @throws XPathException always, after reporting the error to the ErrorListener
     */

    protected void compileError(String message)
            throws XPathException {
        XPathException tce = new XPathException(message);
        tce.setLocator(this);
        compileError(tce);
    }
View Full Code Here

     * @throws XPathException
     */

    protected void compileError(String message, StructuredQName errorCode) throws XPathException {
        // only use message for debug version of Saxon-CE file-size reduced by approx 6KB
      XPathException tce;
        if (LogConfiguration.loggingIsEnabled()) {
          tce = new XPathException(message);
        } else {
          tce = new XPathException("");
        }
        tce.setErrorCodeQName(errorCode);
        tce.setLocator(this);
        compileError(tce);
    }
View Full Code Here

     * @throws XPathException
     */

    protected void compileError(String message, String errorCode) throws XPathException {
      // only use message for debug version of Saxon-CE file-size reduced by approx 6KB
      XPathException tce;
      if (LogConfiguration.loggingIsEnabled()) {
        tce = new XPathException(message);
      } else {
        tce = new XPathException("");
      }
        tce.setErrorCode(errorCode);
        tce.setLocator(this);
        compileError(tce);
    }
View Full Code Here

        rawFlags = flags;
        REFlags reFlags;
        try {
            reFlags = new REFlags(flags, hostLanguage);
        } catch (RESyntaxException err) {
            throw new XPathException(err.getMessage()"FORX0001");
        }
        try {
            rawPattern = GeneralUnicodeString.makeUnicodeString(pattern);
            RECompiler comp2 = new RECompiler();
            comp2.setFlags(reFlags);
            regex = comp2.compile(rawPattern);
            if (warnings != null) {
                for (String s : comp2.getWarnings()) {
                    warnings.add(s);
                }
            }
        } catch (RESyntaxException err) {
            throw new XPathException(err.getMessage(), "FORX0002");
        }
    }
View Full Code Here

     * @throws XPathException if the replacement string is invalid
     */
    public CharSequence replace(CharSequence input, CharSequence replacement) throws XPathException {
        REMatcher matcher = new REMatcher(regex);
        if (matcher.match("")) {
            throw new XPathException("The regular expression must not be one that matches a zero-length string", "FORX0003");
        }
        UnicodeString in = GeneralUnicodeString.makeUnicodeString(input);
        UnicodeString rep = GeneralUnicodeString.makeUnicodeString(replacement);
        try {
            return matcher.subst(in, rep);
        } catch (RESyntaxException err) {
            throw new XPathException(err.getMessage(), "FORX0004");
        }
    }
View Full Code Here

        if (doubleValue == null) {
            try {
                double d = StringToDouble.stringToNumber(value);
                doubleValue = new DoubleValue(d);
            } catch (NumberFormatException e) {
                throw new XPathException("Cannot convert string " + Err.wrap(value) + " to a double");
            }
        }
        return doubleValue;
    }
View Full Code Here

        }
        // empty list in case of further scheduled actions
        list = new ArrayList<PendingUpdateAction>();
      } catch(Exception e) {
        logger.severe("Error on DOM write action: " + state + " " + e.getMessage());
        throw new XPathException(e);
      }


    }
View Full Code Here

                if (kind != Type.NODE && !Axis.containsNodeKind(axis, kind)) {
                     test = EmptySequenceTest.getInstance();
                }
                result = new NodeTestPattern(test);
            } else {
                throw new XPathException("Only downwards axes are allowed in a pattern", "XTSE0340");
            }
            // TODO: //A only matches an A element in a tree rooted at a document
        } else if (expression instanceof FilterExpression) {
            Expression base = ((FilterExpression)expression).getControllingExpression();
            Expression filter = ((FilterExpression)expression).getFilter();
            Pattern basePattern = fromExpression(base, config);
            if (basePattern instanceof NodeTestPattern) {
                LocationPathPattern path = new LocationPathPattern();
                path.setNodeTest(basePattern.getNodeTest());
                basePattern = path;
            }
            if (!(basePattern instanceof LocationPathPattern)) {
                throw new XPathException("The filtered expression in a pattern must be a simple step");
            }
            ((LocationPathPattern)basePattern).addFilter(filter);
            result = basePattern;
        } else if (expression instanceof SlashExpression) {
            Expression head = ((SlashExpression)expression).getLeadingSteps();
            Expression tail =  ((SlashExpression)expression).getLastStep();
            Pattern tailPattern = fromExpression(tail, config);
            if (tailPattern instanceof NodeTestPattern) {
                LocationPathPattern path = new LocationPathPattern();
                path.setNodeTest(tailPattern.getNodeTest());
                tailPattern = path;
            }
            if (!(tailPattern instanceof LocationPathPattern)) {
                throw new XPathException("The path in a pattern must contain simple steps: found " + tailPattern.toString());
            }
            if (((LocationPathPattern)tailPattern).getUpperPattern() != null) {
                throw new XPathException("The path in a pattern must contain simple steps");
            }
            byte axis = getAxisForPathStep(tail);
            Pattern headPattern = fromExpression(head, config);
            ((LocationPathPattern)tailPattern).setUpperPattern(axis, headPattern);
            result = tailPattern;
        } else if (expression instanceof RootExpression) {
            result = new NodeTestPattern(NodeKindTest.DOCUMENT);
        } else if (expression instanceof IXSLFunction) {
          result = new JSObjectPattern(expression, config);
        } else {
            TypeHierarchy th = config.getTypeHierarchy();
            ItemType type = expression.getItemType(th);
            if (((expression.getDependencies() & StaticProperty.DEPENDS_ON_NON_DOCUMENT_FOCUS) == 0) &&
                    (type instanceof NodeTest || expression instanceof VariableReference)) {
                result = new NodeSetPattern(expression, config);
            }
        }
        if (result == null) {
            throw new XPathException("Cannot convert the expression {" + expression.toString() + "} to a pattern");
        } else {
            result.setOriginalText(expression.toString());
            return result;
        }
    }
View Full Code Here

        } else if (step instanceof PathExpression) {
            return getAxisForPathStep(((PathExpression)step).getFirstStep());
        } else if (step instanceof ContextItemExpression) {
            return Axis.SELF;
        } else {
            throw new XPathException("The path in a pattern must contain simple steps");
        }
    }
View Full Code Here

TOP

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