FreemarkerModel.set(model);
TypeDefinition typeDef = model.createTypeDefinition((ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.schema.MapExtendedReference"));
model.add(typeDef);
typeDef = model.createTypeDefinition((ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.schema.RootElementMapAdapted"));
model.add(typeDef);
DefaultValidator validator = new DefaultValidator();
for (SchemaInfo schemaInfo : model.getNamespacesToSchemas().values()) {
for (TypeDefinition typeDefinition : schemaInfo.getTypeDefinitions()) {
ValidationResult result = validator.validateTypeDefinition(typeDefinition);
if (result.hasErrors()) {
for (ValidationMessage validationMessage : result.getErrors()) {
fail(validationMessage.getText());
}
}