Class ModelGroupDefinition

All Implemented Interfaces:
SerializableSchemaComponent, Term, UserSchemaComponent, SourceLocator, Location, SchemaComponent, Locator

public class ModelGroupDefinition extends ModelGroup implements SerializableSchemaComponent
A Model Group Definition: a schema component corresponding to a top-level (named) xs:group element in a schema document.
  • Constructor Details

    • ModelGroupDefinition

      public ModelGroupDefinition(EnterpriseConfiguration config, SourceLocator locator)
      Creates a new Model Group definition
      Parameters:
      config - the Configuration to which this Model Group definition belongs
      locator - the source location of the model group definition
  • Method Details

    • setRedefinedModelGroupDefinition

      public void setRedefinedModelGroupDefinition(ModelGroupDefinition other)
      Set the model group definition that this one redefines. Only set if this is a redefining model group that does not contain a self-reference; in this case validate() must check that it is a valid refinement
      Parameters:
      other - the model group that this one redefines
    • setModelGroupName

      public void setModelGroupName(StructuredQName nameCode)
    • getModelGroupName

      public StructuredQName getModelGroupName()
    • getName

      public String getName()
      Returns the local part of the name of this named Group.
      Returns:
      the local name of this named Group.
    • getTargetNamespace

      public NamespaceUri getTargetNamespace()
      Returns the namespace URI of the name of this named Group.
      Returns:
      the namespace URI of this named Group: null if the group is in no namespace
    • isEmptiable

      public boolean isEmptiable() throws MissingComponentException
      Determine if empty content is allowed
      Specified by:
      isEmptiable in class ModelGroup
      Returns:
      true if the content model of the model group allows empty content
      Throws:
      MissingComponentException - if the schema contains unresolved references to required components
    • isPointless

      public boolean isPointless(ModelGroup container)
      Test whether the compositor is pointless, as described in XML Schema Part 1 Schema Component Constraint: Particle Valid (Restriction)
      Overrides:
      isPointless in class ModelGroup
      Parameters:
      container - the particle that contains this model group definition
      Returns:
      true if this compositor is pointless
    • lookForCycles

      public void lookForCycles(Stack<SchemaComponent> references, SchemaCompiler compiler) throws SchemaException
      This method is called to look for cycles. The object implementing this method is required (a) to raise an exception if the object itself appears in the list of references, (b) to add itself to the list of references, and (c) to call the lookForCycles method on all the objects that it references.
      Specified by:
      lookForCycles in interface UserSchemaComponent
      Overrides:
      lookForCycles in class ModelGroup
      Parameters:
      references - A list of objects that contain direct or indirect references to this object, and that must therefore not be referred to from this object.
      compiler - used for error reporting
      Throws:
      SchemaException - if cycles are found
    • validate

      public boolean validate(SchemaCompiler compiler) throws SchemaException
      Checks the validity of this Model Group Definition.
      Specified by:
      validate in interface UserSchemaComponent
      Overrides:
      validate in class ModelGroup
      Parameters:
      compiler - the schema compiler
      Returns:
      true when this Schema definition is valid, otherwise false.
      Throws:
      SchemaException - if the declaration is invalid
    • isSameGroup

      public boolean isSameGroup(ModelGroupDefinition other)
      Test whether this is the same group as another group. They are considered to be the same type if they are derived from the same type definition in the original XML representation (which can happen when there are multiple includes of the same file)
      Parameters:
      other - the other group
      Returns:
      true if the groups are the same
    • serialize

      public void serialize(SchemaModelSerializer serializer) throws XPathException
      Serialize the schema component
      Specified by:
      serialize in interface SerializableSchemaComponent
      Overrides:
      serialize in class ModelGroup
      Parameters:
      serializer - used to receive the serialized output
      Throws:
      XPathException - if serialization fails
    • getCompositorName

      public String getCompositorName()
      Description copied from class: ModelGroup
      Get the name of the compositor used in this model group
      Specified by:
      getCompositorName in class ModelGroup
      Returns:
      one of "sequence", "choice", or "all"
    • getComponentAsFunction

      public FunctionItem getComponentAsFunction()
      Description copied from interface: SchemaComponent
      Get the schema component in the form of a function item. This allows schema information to be made visible to XSLT or XQuery code. The function makes available the contents of the schema component as defined in the XSD specification. The function takes a string as argument representing a property name, and returns the corresponding property of the schema component. There is also a property "class" which returns the kind of schema component, for example "Attribute Declaration".
      Specified by:
      getComponentAsFunction in interface SchemaComponent
      Overrides:
      getComponentAsFunction in class ModelGroup
      Returns:
      the schema component represented as a function from property names to property values.