|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.exolab.castor.xml.schema.Structure
org.exolab.castor.xml.schema.Annotated
org.exolab.castor.xml.schema.Schema
public class Schema
A class representing an XML Schema Definition. This class also contains some Factory methods for creating Top-Level structures.
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_SCHEMA_NS
The Namespace supported by the W3C XML Schema Recommendation. |
static java.lang.String |
XSI_NAMESPACE
The Namespace supported by the W3C XML Schema Recommendation for the built-in types: xsi:type, xsi:nil, and xsi:schemaLocation. |
Fields inherited from class org.exolab.castor.xml.schema.Structure |
---|
ANNOTATION, ANYTYPE, APPINFO, ATTRIBUTE, ATTRIBUTE_GROUP, COMPLEX_CONTENT, COMPLEX_TYPE, DOCUMENTATION, ELEMENT, FACET, GROUP, IDENTITY_FIELD, IDENTITY_SELECTOR, KEY, KEYREF, LIST, MODELGROUP, MODELGROUP_REF, REDEFINE, SCHEMA, SIMPLE_CONTENT, SIMPLE_TYPE, UNION, UNIQUE, UNKNOWN, WILDCARD |
Constructor Summary | |
---|---|
Schema()
Creates a new Schema definition |
|
Schema(java.lang.String schemaNS)
Creates a new Schema definition |
|
Schema(java.lang.String prefix,
java.lang.String schemaNS)
Creates a new Schema definition |
Method Summary | |
---|---|
void |
addAttribute(AttributeDecl attribute)
Adds the given attribute definition to this Schema definition |
void |
addAttributeGroup(AttributeGroupDecl attrGroup)
Adds the given attribute group definition to this Schema definition. |
void |
addComplexType(ComplexType complexType)
Adds the given Complextype definition to this Schema defintion |
void |
addElementDecl(ElementDecl elementDecl)
Adds the given Element declaration to this Schema defintion |
void |
addImportedSchema(Schema schema)
Adds the given Schema definition to this Schema definition as an imported schenma |
void |
addInclude(java.lang.String include)
Indicates that the given XML Schema file has been processed via an |
void |
addModelGroup(ModelGroup group)
Adds the given Group declaration to this Schema definition |
void |
addNamespace(java.lang.String prefix,
java.lang.String ns)
Adds to the namespaces declared in this Schema |
void |
addRedefineSchema(RedefineSchema schema)
Adds the given redefinition of structures to this Schema definition. |
void |
addSimpleType(SimpleType simpleType)
Adds the given SimpletType definition to this Schema defintion |
void |
cacheIncludedSchema(Schema schema)
Caches the given Schema definition as an included XML Schema of this Schema definition. |
ComplexType |
createComplexType()
Creates a new ComplexType using this Schema as the owning Schema document. |
ComplexType |
createComplexType(java.lang.String name)
Creates a new ComplexType using this Schema as the owning Schema document. |
SimpleType |
createSimpleType(java.lang.String name,
SimpleType baseType)
Creates a new SimpleType using this Schema as the owning Schema document. |
SimpleType |
createSimpleType(java.lang.String name,
java.lang.String baseName,
java.lang.String derivation)
Creates a new SimpleType using this Schema as the owning Schema document. |
AttributeDecl |
getAttribute(java.lang.String name)
Returns the top-level Attribute associated with the given name. |
Form |
getAttributeFormDefault()
Returns the attributeFormDefault property of this Schema. |
AttributeGroup |
getAttributeGroup(java.lang.String name)
Returns the AttributeGroup associated with the given name. |
java.util.Enumeration |
getAttributeGroups()
Returns an Enumeration of all top-level AttributeGroup declarations |
java.util.Enumeration |
getAttributes()
Returns an Enumeration of all top-level Attribute declarations |
BlockList |
getBlockDefault()
Returns the default BlockList for this Schema. |
java.lang.String |
getBuiltInTypeName(int builtInTypeCode)
Gets a built in type's name given its code. |
Schema |
getCachedIncludedSchema(java.lang.String schemaLocation)
Returns the cached included schema with the given SchemaLocation |
java.util.Enumeration |
getCachedIncludedSchemas()
Returns an enumeration of all the included schemas that are cached in this XML Schema Definition. |
ComplexType |
getComplexType(java.lang.String name)
Returns the ComplexType of associated with the given name |
java.util.Enumeration |
getComplexTypes()
Returns an Enumeration of all top-level ComplexType declarations |
ElementDecl |
getElementDecl(java.lang.String name)
Returns the ElementDecl of associated with the given name |
java.util.Enumeration |
getElementDecls()
Returns an Enumeration of all top-level element declarations |
Form |
getElementFormDefault()
Returns the elementFormDefault property of this Schema. |
FinalList |
getFinalDefault()
Returns the default FinalList for this Schema. |
java.lang.String |
getId()
Returns the Id for this Schema, as specified by the Id attribute, or null if no Id exists. |
java.util.Enumeration |
getImportedSchema()
Returns the imported schemas of this schema |
Schema |
getImportedSchema(java.lang.String ns)
Returns the imported schema with the given namespace |
Schema |
getImportedSchema(java.lang.String ns,
boolean localOnly)
Returns the imported schema with the given namespace |
protected Schema |
getMasterSchema()
Returns the master schema in which this instance of schema is used at runtime. |
ModelGroup |
getModelGroup(java.lang.String name)
Returns the ModeGroup of associated with the given name |
java.util.Enumeration |
getModelGroups()
Returns an Enumeration of all top-level ModelGroup declarations |
java.lang.String |
getNamespace(java.lang.String prefix)
Returns the namespace associated with the given prefix. |
protected java.lang.String |
getNamespacePrefix(java.lang.String namespace)
Returns the namespace prefix associated with the given namespace. |
Namespaces |
getNamespaces()
Returns the namespaces declared for this Schema |
java.util.Enumeration |
getRedefineSchema()
Returns an enumeration of redefined schemas. |
RedefineSchema |
getRedefineSchema(java.lang.String schemaLocation)
Returns the redefined schema corresponding schemaLocation. |
java.lang.String |
getSchemaLocation()
Returns the schemaLocation hint provided of this schema |
java.lang.String |
getSchemaNamespace()
Returns the namespace of the XML Schema Note: This is not the same as targetNamespace. |
SimpleType |
getSimpleType(java.lang.String name)
Returns the SimpleType associated with the given name, or null if no such SimpleType exists. |
SimpleType |
getSimpleType(java.lang.String name,
java.lang.String namespace)
Returns the SimpleType associated with the given name and namespace, or null if no such SimpleType exists. |
java.util.Enumeration |
getSimpleTypes()
Returns an Enumeration of all SimpleType declarations |
short |
getStructureType()
Returns the type of this Schema Structure |
java.lang.String |
getTargetNamespace()
Returns the target namespace for this Schema, or null if no namespace has been defined. |
XMLType |
getType(java.lang.String typeName)
Returns the first simple or complex type which name equals TypeName |
(package private) static SimpleTypesFactory |
getTypeFactory()
Gets the type factory, package private |
java.lang.String |
getVersion()
Returns the version information of the XML Schema definition represented by this Schema instance. |
boolean |
includeProcessed(java.lang.String includeFile)
Returns True if the given XML Schema has already been included via |
boolean |
isKnownNamespace(java.lang.String namespaceURL)
Returns True if the namespace is known to this schema |
boolean |
removeAttribute(AttributeDecl attribute)
Removes the given top level Attribute from this Schema |
boolean |
removeAttributeGroup(AttributeGroupDecl group)
Removes the given AttributeGroup definition from this Schema |
boolean |
removeCachedIncludedSchema(Schema schema)
Removes the given cached included schema from this Schema definition's list of cached included schema. |
boolean |
removeComplexType(ComplexType complexType)
Removes the given top level ComplexType from this Schema |
boolean |
removeElement(ElementDecl element)
Removes the given top level Element from this Schema |
boolean |
removeGroup(ModelGroup group)
Removes the given top level ModelGroup definition from this Schema |
boolean |
removeImportedSchema(Schema schema)
Removes the given Schema definition from this Schema definition's list of imported schenma |
boolean |
removeNamespace(java.lang.String prefix)
Removes the namespace from the set of namespace declarations for this Schema definition. |
boolean |
removeRedefineSchema(RedefineSchema schema)
Removes the given redefined structure from this Schema definition's list of redefinitions. |
boolean |
removeSimpleType(SimpleType simpleType)
Removes the given top level SimpleType from this Schema |
void |
setAttributeFormDefault(Form attributeFormDefault)
Sets the attributeFormDefault property of this Schema. |
void |
setBlockDefault(BlockList block)
Sets the default BlockList for this Schema. |
void |
setBlockDefault(java.lang.String block)
Sets the default Block values for this Schema. |
void |
setElementFormDefault(Form elementFormDefault)
Sets the elementFormDefault property of this Schema. |
void |
setFinalDefault(FinalList finalList)
Sets the default FinalList for this Schema. |
void |
setFinalDefault(java.lang.String finalValues)
Sets the default final values for this Schema. |
void |
setId(java.lang.String id)
Sets the Id for this Schema |
protected void |
setMasterSchema(Schema masterSchema)
Sets the master schema in which this instance of schema is used at runtime. |
void |
setSchemaLocation(java.lang.String schemaLocation)
Set the schemaLocation for this schema. |
void |
setTargetNamespace(java.lang.String targetNamespace)
Sets the target namespace for this Schema |
void |
setVersion(java.lang.String version)
Sets the version information for the XML Schema defintion represented by this Schema instance. |
void |
validate()
Checks the validity of this Schema definition. |
Methods inherited from class org.exolab.castor.xml.schema.Annotated |
---|
addAnnotation, getAnnotations, removeAnnotation |
Methods inherited from class org.exolab.castor.xml.schema.Structure |
---|
isValid |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DEFAULT_SCHEMA_NS
public static final java.lang.String XSI_NAMESPACE
Constructor Detail |
---|
public Schema()
public Schema(java.lang.String schemaNS)
schemaNS
- the namespace of the XML Schema itself. Note
this is not the same as the targetNamespace.public Schema(java.lang.String prefix, java.lang.String schemaNS)
prefix
- the desired namespace prefix for the schemaNS.schemaNS
- the namespace of the XML Schema itself. Note
this is not the same as the targetNamespace.Method Detail |
---|
public void addAttribute(AttributeDecl attribute) throws SchemaException
attribute
- the AttributeDecl to add
SchemaException
- if an AttributeDecl
already exisits with the same namepublic void addAttributeGroup(AttributeGroupDecl attrGroup) throws SchemaException
attrGroup
- the AttributeGroupDecl to add
SchemaException
- if an AttributeGroupDecl
already exisits with the same namepublic void addComplexType(ComplexType complexType) throws SchemaException
complextype
- the Complextype to add to this Schema
SchemaException
- if the Complextype does not have
a name or if another Complextype already exists with the same namepublic void addElementDecl(ElementDecl elementDecl) throws SchemaException
elementDecl
- the ElementDecl to add to this SchemaDef
SchemaException
- when an ElementDecl already
exists with the same name as the given ElementDeclpublic void addModelGroup(ModelGroup group) throws SchemaException
group
- the Group to add to this SchemaDef
SchemaException
- when an Group already
exists with the same name as the given Grouppublic void addRedefineSchema(RedefineSchema schema) throws SchemaException
redefineSchema
- the Group to add to this SchemaDef
SchemaException
- when an redefintion already
exists with the same name as the given ElementDeclpublic void addImportedSchema(Schema schema) throws SchemaException
schema
- the Schema to add to this Schema as an imported schema
SchemaException
- if the Schema already existspublic void cacheIncludedSchema(Schema schema) throws SchemaException
schema
- the Schema to add to this Schema as a cached included schema.
SchemaException
- if the Schema already existspublic void addNamespace(java.lang.String prefix, java.lang.String ns)
namespaces
- the list of namespacespublic void addSimpleType(SimpleType simpleType) throws SchemaException
simpletype
- the SimpleType to add to this Schema
SchemaException
- if the SimpleType does not have
a name or if another SimpleType already exists with the same namepublic ComplexType createComplexType()
public ComplexType createComplexType(java.lang.String name)
name
- the name of the ComplexType
public SimpleType createSimpleType(java.lang.String name, java.lang.String baseName, java.lang.String derivation)
name
- the name of the SimpleTypebaseName
- the name of the SimpleType's base typederivation
- the name of the derivation method (""/"list"/"restriction")
public SimpleType createSimpleType(java.lang.String name, SimpleType baseType)
name
- the name of the SimpleTypebaseType
- the base type of the SimpleType to create
public Form getAttributeFormDefault()
public java.util.Enumeration getAttributes()
public AttributeDecl getAttribute(java.lang.String name)
public java.util.Enumeration getAttributeGroups()
public AttributeGroup getAttributeGroup(java.lang.String name)
public BlockList getBlockDefault()
public java.lang.String getBuiltInTypeName(int builtInTypeCode)
public ComplexType getComplexType(java.lang.String name)
public java.util.Enumeration getComplexTypes()
public ElementDecl getElementDecl(java.lang.String name)
public java.util.Enumeration getElementDecls()
public Form getElementFormDefault()
public FinalList getFinalDefault()
public SimpleType getSimpleType(java.lang.String name)
name
- the name of the SimpleType. The name may
be a QName (contain a namespace prefix).
public SimpleType getSimpleType(java.lang.String name, java.lang.String namespace)
name
- the name of the simpleType. It is an error
if this name contains a prefix, it must be an NCName.namespace
- the namespace URI of the simpleType.
public java.util.Enumeration getSimpleTypes()
public java.lang.String getSchemaLocation()
public ModelGroup getModelGroup(java.lang.String name)
public java.util.Enumeration getModelGroups()
public java.lang.String getId()
public java.util.Enumeration getImportedSchema()
public Schema getImportedSchema(java.lang.String ns)
ns
- the namespace of the imported schema to return
public java.util.Enumeration getRedefineSchema()
public RedefineSchema getRedefineSchema(java.lang.String schemaLocation)
schemaLocation
- the string corresponding to the schemaLocation.
public Schema getCachedIncludedSchema(java.lang.String schemaLocation)
schemaLocation
- the schemaLocation value used as a key to store the
cached included XML schema
public java.util.Enumeration getCachedIncludedSchemas()
public Schema getImportedSchema(java.lang.String ns, boolean localOnly)
ns
- the namespace of the imported schema to returnlocalOnly
- a boolean that indicates only local imports
should be searched.
public final java.lang.String getNamespace(java.lang.String prefix)
public Namespaces getNamespaces()
public void addInclude(java.lang.String include)
public boolean includeProcessed(java.lang.String includeFile)
public java.lang.String getSchemaNamespace()
public java.lang.String getTargetNamespace()
public java.lang.String getVersion()
public boolean isKnownNamespace(java.lang.String namespaceURL)
namespace
- the namespace URL
public boolean removeComplexType(ComplexType complexType)
complexType
- the ComplexType to remove
public boolean removeElement(ElementDecl element)
element
- the ElementDecl to remove
public boolean removeAttribute(AttributeDecl attribute)
attribute
- the AttributeDecl to remove
public boolean removeGroup(ModelGroup group)
group
- the ModelGroup definition to remove
public boolean removeAttributeGroup(AttributeGroupDecl group)
group
- the AttributeGroup definition to remove
public boolean removeCachedIncludedSchema(Schema schema)
schema
- the Schema to remove from this Schema's redefinition list
public boolean removeImportedSchema(Schema schema)
schema
- the Schema to remove from this Schema's import list
public boolean removeNamespace(java.lang.String prefix)
prefix
- the namespace prefix of the namespace to remove.public boolean removeRedefineSchema(RedefineSchema schema)
schema
- the Schema to remove from this Schema's redefinition list
public boolean removeSimpleType(SimpleType simpleType)
SimpleType
- the SimpleType to remove
public void setAttributeFormDefault(Form attributeFormDefault)
attributeFormDefault
- the Form value of the attributeFormDefault
property for this Schema.public void setBlockDefault(BlockList block)
block
- the default BlockList to set for this Schema.public void setBlockDefault(java.lang.String block)
block
- the default Block values to set for this Schema.public void setElementFormDefault(Form elementFormDefault)
elementFormDefault
- the Form value of the elementFormDefault
property for this Schema.public void setFinalDefault(FinalList finalList)
final
- the default FinalList to set for this Schema.public void setFinalDefault(java.lang.String finalValues)
finalValues
- the default final values to set for this Schema.public void setSchemaLocation(java.lang.String schemaLocation)
schemaLocation
- the location hint for this Schemapublic XMLType getType(java.lang.String typeName)
public void setId(java.lang.String id)
id
- the Id for this Schemapublic void setTargetNamespace(java.lang.String targetNamespace)
targetNamespace
- the target namespace for this Schemapublic void setVersion(java.lang.String version)
the
- version for this XML Schema defination.static SimpleTypesFactory getTypeFactory()
public short getStructureType()
getStructureType
in class Structure
public void validate() throws ValidationException
validate
in class Structure
ValidationException
- when this Schema definition
is invalid.protected java.lang.String getNamespacePrefix(java.lang.String namespace)
protected Schema getMasterSchema()
protected void setMasterSchema(Schema masterSchema)
the
- master schema in which this instance of schema
is used at runtime. This method is meant to be used at runtime.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |