org.jibx.schema
Class SchemaHolder

java.lang.Object
  extended by org.jibx.util.HolderBase
      extended by org.jibx.schema.SchemaHolder

public class SchemaHolder
extends HolderBase

External data for a schema definition. This tracks references to other schemas, along with the associated namespace information. The finish() method actually generates the includes.

Author:
Dennis M. Sosnoski

Field Summary
private  UniqueNameSet m_elementNameSet
          Set of element names defined in schema (also used for group/attributeGroup).
private  java.util.Set m_fixedSet
          Set of schemas imported into this schema.
private  SchemaElement m_schema
          Actual schema definition.
private  UniqueNameSet m_typeNameSet
          Set of type names defined in schema.
 
Constructor Summary
SchemaHolder(java.lang.String uri)
          Constructor.
 
Method Summary
 java.lang.String addElementName(java.lang.String base)
          Add element name to set defined.
protected  void addNamespaceDecl(java.lang.String prefix, java.lang.String uri)
          Implementation method to handle adding a namespace declaration.
 java.lang.String addTypeName(java.lang.String base)
          Add type name to set defined.
 void finish()
          Implementation method to handle references from this schema to other schemas.
 SchemaElement getSchema()
          Get the schema definition.
 
Methods inherited from class org.jibx.util.HolderBase
addReference, getFileName, getNamespace, getPrefix, getReferences, setFileName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_schema

private final SchemaElement m_schema
Actual schema definition.


m_typeNameSet

private final UniqueNameSet m_typeNameSet
Set of type names defined in schema.


m_elementNameSet

private final UniqueNameSet m_elementNameSet
Set of element names defined in schema (also used for group/attributeGroup).


m_fixedSet

private java.util.Set m_fixedSet
Set of schemas imported into this schema.

Constructor Detail

SchemaHolder

public SchemaHolder(java.lang.String uri)
Constructor.

Parameters:
uri - (null if no-namespace schema)
Method Detail

getSchema

public SchemaElement getSchema()
Get the schema definition.

Returns:
definition

addTypeName

public java.lang.String addTypeName(java.lang.String base)
Add type name to set defined. This assures uniqueness of the name used, if necessary modifying the supplied base name to a unique alternative.

Parameters:
base - name to try adding
Returns:
name to be used for type

addElementName

public java.lang.String addElementName(java.lang.String base)
Add element name to set defined. This assures uniqueness of the name used, if necessary modifying the supplied base name to a unique alternative. The same set of names is also used for groups and attributeGroups, even though these name sets are separate in schema terms. Doing things this way avoids the possibility of an element name matching a group name with the two representing different structures.

Parameters:
base - name to try adding
Returns:
name to be used for element

addNamespaceDecl

protected void addNamespaceDecl(java.lang.String prefix,
                                java.lang.String uri)
Implementation method to handle adding a namespace declaration. This sets up the namespace declaration for output in the generated XML.

Specified by:
addNamespaceDecl in class HolderBase
Parameters:
prefix -
uri -

finish

public void finish()
Implementation method to handle references from this schema to other schemas. This adds import elements to the constructed schema for all referenced schemas.

Specified by:
finish in class HolderBase


Project Web Site