Package org.jibx.schema.validation

Examples of org.jibx.schema.validation.ValidationContext.addError()


            if (ns == null || ns.length() == 0) {
               
                // check if no-namespace attribute in allowed set
                if (attrs.indexOf(name) < 0) {
                    ValidationContext vctx = (ValidationContext)ictx.getUserContext();
                    vctx.addError("Undefined attribute " + name, ictx.getStackTop());
                }
               
            } else if (WSDL_NAMESPACE_URI.equals(ns)) {
               
                // no unknown attributes from definition namespace are defined
View Full Code Here


               
            } else if (WSDL_NAMESPACE_URI.equals(ns)) {
               
                // no unknown attributes from definition namespace are defined
                ValidationContext vctx = (ValidationContext)ictx.getUserContext();
                vctx.addError("Undefined attribute " + name, ictx.getStackTop());
               
            } else if (!other) {
               
                // warn on non-WSDL attribute present where forbidden
                ValidationContext vctx = (ValidationContext)ictx.getUserContext();
View Full Code Here

        // get the class to be used for class decorator instance
        ValidationContext vctx = (ValidationContext)ictx.getUserContext();
        UnmarshallingContext ctx = (UnmarshallingContext)ictx;
        String cname = ctx.attributeText(null, "class", null);
        if (cname == null) {
            vctx.addError("Missing required 'class' attribute", new ProblemLocation(ctx));
        } else {
            try {
               
                // make sure the class implements the required interface
                Class clas = SchemaRootBase.class.getClassLoader().loadClass(cname);
View Full Code Here

            try {
               
                // make sure the class implements the required interface
                Class clas = SchemaRootBase.class.getClassLoader().loadClass(cname);
                if (ClassDecorator.class.isAssignableFrom(clas)) {
                    vctx.addError("Class " + cname + " does not implement the required IClassDecorator interface",
                        new ProblemLocation(ictx));
                } else {
                    try {
                        return (ClassDecorator)clas.newInstance();
                    } catch (InstantiationException e) {
View Full Code Here

                        new ProblemLocation(ictx));
                } else {
                    try {
                        return (ClassDecorator)clas.newInstance();
                    } catch (InstantiationException e) {
                        vctx.addError("Error creating instance of class " + cname + ": " + e.getMessage(),
                            new ProblemLocation(ictx));
                    } catch (IllegalAccessException e) {
                        vctx.addError("Unable to access constructor for class " + cname + ": " + e.getMessage(),
                            new ProblemLocation(ictx));
                    }
View Full Code Here

                        return (ClassDecorator)clas.newInstance();
                    } catch (InstantiationException e) {
                        vctx.addError("Error creating instance of class " + cname + ": " + e.getMessage(),
                            new ProblemLocation(ictx));
                    } catch (IllegalAccessException e) {
                        vctx.addError("Unable to access constructor for class " + cname + ": " + e.getMessage(),
                            new ProblemLocation(ictx));
                    }
                }
               
            } catch (ClassNotFoundException e) {
View Full Code Here

                            new ProblemLocation(ictx));
                    }
                }
               
            } catch (ClassNotFoundException e) {
                vctx.addError("Unable to find class " + cname + " in classpath", new ProblemLocation(ictx));
            }
        }
        return null;
    }
View Full Code Here

            String stype = ctx.attributeText(null, "type-name");
            boolean valid = true;
            if (jclas == null && format == null) {
               
                // need either 'java-class' or 'format-name', just report error and skip
                vctx.addError("'java-class' attribute is required unless 'format-name' is used", ctx.getStackTop());
                valid = false;
               
            } else if (format != null) {
               
                // check format for existence and consistency
View Full Code Here

            } else if (format != null) {
               
                // check format for existence and consistency
                FormatElement def = (FormatElement)s_nameToFormat.get(format);
                if (def == null) {
                    vctx.addError('\'' + format + "' is not a valid built-in format name", ctx.getStackTop());
                    valid = false;
                } else {
                    if (jclas == null) {
                        jclas = def.getTypeName();
                    }
View Full Code Here

                    if (ctx.getAttributeNamespace(i).length() == 0) {
                        if (!"class".equals(name)) {
                            map.put(name, value);
                        }
                    } else {
                        vctx.addError("Unknown namespaced attribute '" + name + "'", new ProblemLocation(ctx));
                    }
                }
               
                // create and populate values on instance
                try {
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.