Examples of ValidationContext


Examples of org.apache.xerces.impl.dv.ValidationContext

    //normalizedValue etc..)after content is validated.
    ValidatedInfo validatedInfo = new ValidatedInfo();

        //get proper validation context , this is very important we need to get appropriate validation context while validating content
        //validation context passed is generally different while validating content and  creating simple type (applyFacets)
        ValidationContext validationState = getValidationContext();

    try{
        simpleType.validate(content, validationState, validatedInfo);
    }catch(InvalidDatatypeValueException ex){
        System.err.println(ex.getMessage());
View Full Code Here

Examples of org.apache.xerces.impl.dv.ValidationContext

            return validateByDatatypeJena(lexicalForm, datatype, handler, line, col) ;
       
        // From Jena 2.6.3, XSDDatatype.parse
        XSSimpleType typeDeclaration = (XSSimpleType)datatype.extendedTypeDefinition() ;
        try {
            ValidationContext context = new ValidationState();
            ValidatedInfo resultInfo = new ValidatedInfo();
            Object result = typeDeclaration.validate(lexicalForm, context, resultInfo);
            return true ;
        } catch (InvalidDatatypeValueException e) {
            handler.warning("Lexical form '"+lexicalForm+"' not valid for datatype "+datatype.getURI(), line, col) ;
View Full Code Here

Examples of org.apache.xerces.impl.validation.ValidationContext

    //normalizedValue etc..)after content is validated.
    ValidatedInfo validatedInfo = new ValidatedInfo();

  //get proper validation context , this is very important we need to get appropriate validation context while validating content
  //validation context passed is generally different while validating content and  creating simple type (applyFacets)
  ValidationContext validationState = getValidationContext();

    try{
        simpleType.validate(content, validationState, validatedInfo);
    }catch(InvalidDatatypeValueException ex){
        System.err.println(ex.getMessage());
View Full Code Here

Examples of org.jibx.binding.model.ValidationContext

     * <code>null</code> if one or more errors in binding
     */
    public static BindingElement validateBinding(String name, URL url,
        InputStream is) {
        try {
            ValidationContext vctx = BindingElement.newValidationContext();
            BindingElement root =
                BindingElement.validateBinding(name, url, is, vctx);
            if (vctx.getErrorCount() == 0 && vctx.getFatalCount() == 0) {
                return root;
            }
        } catch (JiBXException ex) {
            System.err.println("Unable to process binding " + name);
            ex.printStackTrace();
View Full Code Here

Examples of org.jibx.binding.model.ValidationContext

        m_custom = custom;
        m_classSimpletypes = new HashMap();
        m_uriNames = urinames;
        m_uriSchemas = new HashMap();
        m_formatCache = new FormatterCache(loc);
        m_context = new ValidationContext(loc);
        m_detailDirectory = new DetailDirectory(custom, m_context);
    }
View Full Code Here

Examples of org.jibx.binding.model.ValidationContext

                File file = new File(bpath);
                try {
                    URL url = new URL("file://" + file.getAbsolutePath());
                    FileInputStream is = new FileInputStream(file);
                    try {
                        ValidationContext vctx = new ValidationContext(parms.getLocator());
                        BindingElement binding = BindingElement.validateBinding(name, url, is, vctx);
                        if (vctx.getErrorCount() == 0 && vctx.getFatalCount() == 0) {
                            bindings.add(binding);
                        } else {
                            valid = false;
                        }
                    } catch (JiBXException e) {
View Full Code Here

Examples of org.jibx.binding.model.ValidationContext

        // write the full set of binding definitions to target directory
        m_directory.writeBindings(dir);
       
        // validate the root binding (which will pull in all referenced bindings)
        File file = new File(dir, root.getFileName());
        ValidationContext vctx = new ValidationContext(loc);
        FileInputStream is = new FileInputStream(file);
        BindingElement binding = BindingElement.validateBinding(root.getFileName(), file.toURI().toURL(), is, vctx);
        if (binding == null || vctx.getErrorCount() > 0 || vctx.getFatalCount() > 0) {
            return null;
        } else {
           
            // build and return list of validated binding definitions
            List uris = m_directory.getKeys();
View Full Code Here

Examples of org.jibx.binding.model.ValidationContext

     * @exception JiBXException if error in generating the schema
     */
    public void generate(BindingElement binding) throws JiBXException {
       
        // validate the binding definition
        ValidationContext vctx = new ValidationContext(m_classLocator);
        binding.runValidation(vctx);
        boolean usable = true;
        if (vctx.getProblems().size() > 0) {
           
            // report problems found
            System.err.println("Problems found in binding " +
                binding.getName());
            ArrayList probs = vctx.getProblems();
            for (int i = 0; i < probs.size(); i++) {
                ValidationProblem prob = (ValidationProblem)probs.get(i);
                System.err.println(prob.getDescription());
                if (prob.getSeverity() > ValidationProblem.WARNING_LEVEL) {
                    usable = false;
View Full Code Here

Examples of org.jibx.binding.model.ValidationContext

               
                // Read the JiBX binding definition into memory. The binding definition
                // is only prevalidated so as not to require the user to have all
                // the referenced classes in the classpath, though this does make for
                // added work in finding the namespaces.
                ValidationContext vctx = BindingElement.newValidationContext();
                binding = BindingElement.readBinding(new FileInputStream(file), path, vctx);
                binding.setBaseUrl(file.toURL());
                vctx.setBindingRoot(binding);
                IncludePrevalidationVisitor ipv = new IncludePrevalidationVisitor(vctx);
                vctx.tourTree(binding, ipv);
                if (vctx.getErrorCount() != 0 || vctx.getFatalCount() != 0) {
                    throw new RuntimeException("invalid jibx binding definition file " + path);
                }
            }
           
            // create table with all built-in format definitions
View Full Code Here

Examples of org.jibx.schema.validation.ValidationContext

     */
    protected boolean loadCustomizations(String path) throws JiBXException, IOException {
       
        // load customizations and check for errors
        String[] spaths = (String[])m_sourcePaths.toArray(new String[m_sourcePaths.size()]);
        ValidationContext vctx = new ValidationContext();
        loadCustomizations(path, new ClassSourceLocator(spaths), vctx);
        ArrayList probs = vctx.getProblems();
        if (probs.size() > 0) {
            for (int i = 0; i < probs.size(); i++) {
                ValidationProblem prob = (ValidationProblem)probs.get(i);
                System.out.print(prob.getSeverity() >=
                    ValidationProblem.ERROR_LEVEL ? "Error: " : "Warning: ");
                System.out.println(prob.getDescription());
            }
            if (vctx.getErrorCount() > 0 || vctx.getFatalCount() > 0) {
                return false;
            }
        }
        return true;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.