1 28 29 package org.jibx.binding.model; 30 31 32 43 44 public class RegistrationVisitor extends ModelVisitor 45 { 46 47 private final ValidationContext m_context; 48 49 54 public RegistrationVisitor(ValidationContext vctx) { 55 m_context = vctx; 56 } 57 58 63 public void visitTree(ElementBase root) { 64 m_context.tourTree(root, this); 65 } 66 67 70 public boolean visit(StructureElementBase node) { 71 if (node.getLabel() != null) { 72 ValidationProblem problem = 73 m_context.getCurrentDefinitions().addNamedStructure(node); 74 if (problem != null) { 75 m_context.addProblem(problem); 76 } 77 } 78 return super.visit(node); 79 } 80 81 84 public boolean visit(MappingElement node) { 85 m_context.getCurrentDefinitions().addTemplate(node, m_context); 86 return super.visit(node); 87 } 88 89 92 public boolean visit(NamespaceElement node) { 93 ValidationProblem problem = 94 m_context.getCurrentDefinitions().addNamespace(node); 95 if (problem != null) { 96 m_context.addProblem(problem); 97 } 98 return super.visit(node); 99 } 100 101 104 public boolean visit(TemplateElement node) { 105 m_context.getCurrentDefinitions().addTemplate(node, m_context); 106 return super.visit(node); 107 } 108 } | Popular Tags |