Package net.sf.saxon.type

Examples of net.sf.saxon.type.ValidationException


            // test whether the value actually conforms to the given type
            try {
                ValidationFailure err = schemaType.validateContent(
                        value, DummyNamespaceResolver.getInstance(), context.getConfiguration().getNameChecker());
                if (err != null) {
                    ValidationException ve = new ValidationException(
                            "Attribute value " + Err.wrap(value, Err.VALUE) +
                                               " does not match the required type " +
                                               schemaType.getDescription() + ". " +
                                               err.getMessage());
                    ve.setErrorCode("XTTE1540");
                    throw ve;
                }
            } catch (UnresolvedReferenceException ure) {
                throw new ValidationException(ure);
            }
        } else if (validationAction== Validation.STRICT ||
                validationAction==Validation.LAX) {
            try {
                ann = context.getConfiguration().validateAttribute(nameCode, value, validationAction);
View Full Code Here


                schemaType.validateContent(value, DummyNamespaceResolver.getInstance());
                if (schemaType.isNamespaceSensitive()) {
                    options |= ReceiverOptions.NEEDS_PREFIX_CHECK;
                }
            } catch (ValidationException err) {
                throw new ValidationException("Attribute value " + Err.wrap(value, Err.VALUE) +
                                               " does not match the required type " +
                                               schemaType.getDescription() + ". " +
                                               err.getMessage());
            }
        } else if (validationAction==Validation.STRICT ||
View Full Code Here

            if (parts[0].equals("") || parts[0].equals("xml")) {
                return;
            }
            int prefixCode = getConfiguration().getNamePool().getCodeForPrefix(parts[0]);
            if (prefixCode == -1) {
                throw new ValidationException("Unknown prefix in QName content " + Err.wrap(token));
            }
            for (int i=namespacesSize-1; i>=0; i--) {
                if (namespaces[i]>>16==prefixCode) {
                    return;
                }
                // TODO: handle undeclared namespaces
            }
        } catch (QNameException err) {
            throw new ValidationException("Invalid QName in content " + Err.wrap(token));
        }
        throw new ValidationException("Undeclared prefix in QName content " + Err.wrap(token));
    }
View Full Code Here

                schemaType.validateContent(value, DummyNamespaceResolver.getInstance());
                if (schemaType.isNamespaceSensitive()) {
                    opt |= ReceiverOptions.NEEDS_PREFIX_CHECK;
                }
            } catch (ValidationException err) {
                throw new ValidationException("Attribute value " + Err.wrap(value, Err.VALUE) +
                                               " does not the match the required type " +
                                               schemaType.getDescription() + ". " +
                                               err.getMessage());
            }
        } else if (validationAction==Validation.STRICT ||
View Full Code Here

                o.setTypeAnnotation(schemaType.getFingerprint());
                if (schemaType.isNamespaceSensitive()) {
                    throw new DynamicError("Cannot validate a parentless attribute whose content is namespace-sensitive");
                }
            } catch (ValidationException err) {
                throw new ValidationException("Attribute value " + Err.wrap(o.getStringValue(), Err.VALUE) +
                                               " does not the match the required type " +
                                               schemaType.getDescription() + ". " +
                                               err.getMessage());
            }
        } else if (validationAction==Validation.STRICT ||
View Full Code Here

TOP

Related Classes of net.sf.saxon.type.ValidationException

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.