/** * Report problems found in binding. * * @param vctx Validation Context * @param handler Problem Handler */ private static void reportBindingProblems(org.jibx.binding.model.ValidationContext vctx, ProblemHandler handler) { StringBuffer buff = new StringBuffer(); ArrayList problems = vctx.getProblems(); for (int i = 0; i < problems.size(); i++) { org.jibx.binding.model.ValidationProblem prob = (org.jibx.binding.model.ValidationProblem)problems.get(i); buff.setLength(0); buff.append(prob.getSeverity() >= org.jibx.binding.model.ValidationProblem.ERROR_LEVEL ? "Error: " : "Warning: "); buff.append(prob.getDescription()); handler.report(buff.toString()); } }
/** * List the schemas in use. * * @param schemas * @param vctx * @param handler */ private static void listSchemas(SchemaElement[] schemas, ValidationContext vctx, ProblemHandler handler) { Set topset = new HashSet(); for (int i = 0; i < schemas.length; i++) { SchemaElement schema = schemas[i]; topset.add(schema); handler.report(" " + "top-level schema " + schema.getResolver().getName()); } for (Iterator iter = vctx.iterateSchemas(); iter.hasNext();) { SchemaElement schema = (SchemaElement)iter.next(); if (!topset.contains(schema)) { handler.report(" " + "referenced schema " + schema.getResolver().getName()); } } }
handler.report(buff.toString()); listSchemas(schemas, m_validationContext, handler); } else { handler.report(buff.toString()); String diff = DataModelUtils.imageDiff(image, DataModelUtils.getImage(m_packageDirectory)); if (diff == null) { handler.report("No difference found from data model file " + model.getPath()); } else { handler.report(diff); handler.report("Difference data model file " + model.getPath() + " not found");