jMethod = new JMethod(JType.Boolean, "isValid");
jsc = jMethod.getSourceCode();
jsc.add("try {");
jsc.indent();
jsc.add("validate();");
jsc.unindent();
jsc.add("}");
jsc.add("catch (org.exolab.castor.xml.ValidationException vex) {");
jsc.indent();
jsc.add("return false;");
jsc.unindent();