Package org.jibx.schema
Class SchemaHolder
- java.lang.Object
-
- org.jibx.util.HolderBase
-
- org.jibx.schema.SchemaHolder
-
public class SchemaHolder extends org.jibx.util.HolderBaseExternal data for a schema definition. This tracks references to other schemas, along with the associated namespace information. Thefinish()method actually generates the includes.- Author:
- Dennis M. Sosnoski
-
-
Constructor Summary
Constructors Constructor Description SchemaHolder(String uri)Constructor for new schema definition file.SchemaHolder(SchemaElement schema)Constructor for existing schema definition file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringaddElementName(String base)Add element name to set defined.protected voidaddNamespaceDecl(String prefix, String uri)Implementation method to handle adding a namespace declaration.StringaddTypeName(String base)Add type name to set defined.voidfinish()Implementation method to handle references from this schema to other schemas.SchemaElementgetSchema()Get the schema definition.
-
-
-
Constructor Detail
-
SchemaHolder
public SchemaHolder(String uri)
Constructor for new schema definition file.- Parameters:
uri- (nullif no-namespace schema)
-
SchemaHolder
public SchemaHolder(SchemaElement schema)
Constructor for existing schema definition file.- Parameters:
schema- schema definition
-
-
Method Detail
-
getSchema
public SchemaElement getSchema()
Get the schema definition.- Returns:
- definition
-
addTypeName
public String addTypeName(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 String addElementName(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(String prefix, String uri)
Implementation method to handle adding a namespace declaration. This sets up the namespace declaration for output in the generated XML.- Specified by:
addNamespaceDeclin classorg.jibx.util.HolderBase- Parameters:
prefix- Prefixuri- 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.- Overrides:
finishin classorg.jibx.util.HolderBase
-
-