Package net.sf.saxon.xpath

Examples of net.sf.saxon.xpath.DynamicError


     * @throws XPathException for example if one value is a date and the other is a time
     */

    public SecondsDurationValue subtract(CalendarValue other) throws XPathException {
        if (!(other instanceof DateValue)) {
            DynamicError err = new DynamicError(
                    "First operand of '-' is a date, but the second is not");
            err.setIsTypeError(true);
            throw err;
        }
        return super.subtract(other);
    }
View Full Code Here


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

            writer.write(target);
            writer.write(' ');
            writer.write(data.toString());
            writer.write('>');
        } catch (java.io.IOException err) {
            throw new DynamicError(err);
        }
    }
View Full Code Here

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

    private static void checkYesOrNo(String key, String value) throws DynamicError {
        if ("yes".equals(value) || "no".equals(value)) {
            // OK
        } else {
            throw new DynamicError("Serialization parameter " + Err.wrap(key) + " must have the value yes or no");
        }
    }
View Full Code Here

        if ("xml".equals(value)) return;
        if ("html".equals(value)) return;
        if ("xhtml".equals(value)) return;
        if ("text".equals(value)) return;
        if (isValidClarkName(value)) return;
        throw new DynamicError("Invalid value for serialization method: " +
                "must be xml, html, xhtml, text, or a QName in '{uri}local' form");

    }
View Full Code Here

    private static void checkPositiveInteger(String key, String value) throws DynamicError {
        try {
            int n = Integer.parseInt(value);
            if (n < 1) {
                throw new DynamicError("Value of " +  Err.wrap(key) + " must be a positive integer");
            }
        } catch (NumberFormatException err) {
            throw new DynamicError("Value of " +  Err.wrap(key) + " must be a positive integer");
        }
    }
View Full Code Here

        while (tok.hasMoreTokens()) {
            String s = tok.nextToken();
            if (isValidClarkName(s) || XMLChar.isValidNCName(s)) {
                // ok
            } else {
                throw new DynamicError("Value of " +  Err.wrap(key) +
                        " must be a list of QNames in '{uri}local' notation");
            }
        }
    }
View Full Code Here

        case Type.UNTYPED_ATOMIC:
            return new UntypedAtomicValue(getStringValue());
        case Type.HEX_BINARY:
            return new HexBinaryValue(binaryValue);
        default:
            DynamicError err = new DynamicError("Cannot convert base64Binary to " +
                                     StandardNames.getDisplayName(requiredType));
            err.setXPathContext(context);
            err.setErrorCode("FORG0001");
            throw err;
        }
    }
View Full Code Here

        } else if (target == Object.class) {
            return getStringValue();
        } else {
            Object o = super.convertToJava(target, config, context);
            if (o == null) {
                throw new DynamicError("Conversion of base64Binary to " + target.getName() +
                        " is not supported");
            }
            return o;
        }
    }
View Full Code Here

TOP

Related Classes of net.sf.saxon.xpath.DynamicError

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.