Class SchemaContextTracker

java.lang.Object
org.jibx.schema.SchemaContextTracker
All Implemented Interfaces:
ISchemaListener
Direct Known Subclasses:
ValidationContext

public class SchemaContextTracker extends Object implements ISchemaListener
Current schema name context tracker. This tracks the current schema and the name register associated with that schema.
  • Field Details

    • m_nameRegister

      protected NameRegister m_nameRegister
      Schema global name register.
    • m_traversedSchemas

      private final Set m_traversedSchemas
      Set of schema elements already visited.
    • m_schemaStack

      private final ObjectStack m_schemaStack
      Schema element stack. The bottom item in this will always be the root schema element being traversed, while other items represent referenced schemas. The top item will always be the current schema.
  • Constructor Details

    • SchemaContextTracker

      public SchemaContextTracker()
      Constructor.
  • Method Details

    • getNameRegister

      public NameRegister getNameRegister()
      Get name register. This requires the name register to have been set, throwing an exception if it has not.
      Returns:
      name register (never null)
    • setNameRegister

      public void setNameRegister(NameRegister reg)
      Set name register. This is provided for cases where components are being processed individually, so that the user can set the appropriate register for a component directly.
      Parameters:
      reg -
    • getCurrentSchema

      public SchemaElement getCurrentSchema()
      Get current schema element. This requires the schema to have been set, throwing an exception if it has not.
      Returns:
      current schema element (never null)
    • clearTraversed

      public void clearTraversed()
      Clear the set of schemas that have been traversed. This must be called between passes on a set of schemas, so that all the schemas will again be processed in the new pass.
    • enterSchema

      public boolean enterSchema(SchemaElement schema)
      Description copied from interface: ISchemaListener
      Enter schema. This is called before beginning the traversal of a schema, including both standalone schemas and referenced schemas.
      Specified by:
      enterSchema in interface ISchemaListener
      Parameters:
      schema -
      Returns:
      true if schema should be entered, false if not
    • exitSchema

      public void exitSchema()
      Description copied from interface: ISchemaListener
      Exit schema. This is called when the tranversal of a schema is completed.
      Specified by:
      exitSchema in interface ISchemaListener