java.io.Serializable
public class Schema extends Annotated
Modifier and Type | Field | Description |
---|---|---|
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.
|
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 | Description |
---|---|
Schema() |
Creates a new Schema definition
|
Schema(java.lang.String schemaNS) |
Creates a new Schema definition
|
Schema(java.lang.String prefix,
java.lang.String schemaNamespace) |
Creates a new Schema definition
|
Modifier and Type | Method | Description |
---|---|---|
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,
java.lang.String baseName,
java.lang.String derivation) |
Creates a new SimpleType 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.
|
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.Collection<AttributeGroup> |
getAttributeGroups() |
Returns an Enumeration of all top-level AttributeGroup declarations
|
java.util.Collection<AttributeDecl> |
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.Collection<Schema> |
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.Collection<ComplexType> |
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.Collection<ElementDecl> |
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.Collection<Schema> |
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.Collection<ModelGroup> |
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.
|
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.Collection<RedefineSchema> |
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.Collection<SimpleType> |
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(java.lang.String block) |
Sets the default Block values for this Schema.
|
void |
setBlockDefault(BlockList block) |
Sets the default BlockList for this Schema.
|
void |
setElementFormDefault(Form elementFormDefault) |
Sets the elementFormDefault property of this Schema.
|
void |
setFinalDefault(java.lang.String finalValues) |
Sets the default final values for this Schema.
|
void |
setFinalDefault(FinalList finalList) |
Sets the default FinalList 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. |
addAnnotation, getAnnotations, removeAnnotation
public static final java.lang.String DEFAULT_SCHEMA_NS
public static final java.lang.String XSI_NAMESPACE
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 schemaNamespace)
prefix
- the desired namespace prefix for the schemaNS.schemaNamespace
- the namespace of the XML Schema itself. Note
this is not the same as the targetNamespace.public void addAttribute(AttributeDecl attribute) throws SchemaException
attribute
- the AttributeDecl to addSchemaException
public void addAttributeGroup(AttributeGroupDecl attrGroup) throws SchemaException
attrGroup
- the AttributeGroupDecl to addSchemaException
- if an AttributeGroupDecl
already exisits with the same namepublic void addComplexType(ComplexType complexType) throws SchemaException
complexType
- the Complextype to add to this SchemaSchemaException
- 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 SchemaDefSchemaException
- 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 SchemaDefSchemaException
- when an Group already
exists with the same name as the given Grouppublic void addRedefineSchema(RedefineSchema schema) throws SchemaException
schema
- the Group to add to this SchemaDefSchemaException
- 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 schemaSchemaException
- 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)
public void addSimpleType(SimpleType simpleType) throws SchemaException
simpleType
- the SimpleType to add to this SchemaSchemaException
- 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 ComplexTypepublic 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 createpublic Form getAttributeFormDefault()
public java.util.Collection<AttributeDecl> getAttributes()
public AttributeDecl getAttribute(java.lang.String name)
public java.util.Collection<AttributeGroup> 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.Collection<ComplexType> getComplexTypes()
public ElementDecl getElementDecl(java.lang.String name)
public java.util.Collection<ElementDecl> 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.Collection<SimpleType> getSimpleTypes()
public java.lang.String getSchemaLocation()
public ModelGroup getModelGroup(java.lang.String name)
public java.util.Collection<ModelGroup> getModelGroups()
public java.lang.String getId()
public java.util.Collection<Schema> getImportedSchema()
public Schema getImportedSchema(java.lang.String ns)
ns
- the namespace of the imported schema to returnpublic java.util.Collection<RedefineSchema> 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 schemapublic java.util.Collection<Schema> 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)
namespaceURL
- the namespace URLpublic boolean removeComplexType(ComplexType complexType)
complexType
- the ComplexType to removepublic boolean removeElement(ElementDecl element)
element
- the ElementDecl to removepublic boolean removeAttribute(AttributeDecl attribute)
attribute
- the AttributeDecl to removepublic boolean removeGroup(ModelGroup group)
group
- the ModelGroup definition to removepublic boolean removeAttributeGroup(AttributeGroupDecl group)
group
- the AttributeGroup definition to removepublic boolean removeCachedIncludedSchema(Schema schema)
schema
- the Schema to remove from this Schema's redefinition listpublic boolean removeImportedSchema(Schema schema)
schema
- the Schema to remove from this Schema's import listpublic 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 listpublic boolean removeSimpleType(SimpleType simpleType)
simpleType
- the SimpleType to removepublic 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)
finalList
- 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)
version
- the version for this XML Schema defination.static SimpleTypesFactory getTypeFactory()
public short getStructureType()
getStructureType
in class Structure
public void validate() throws ValidationException
Schema
definition.validate
in class Structure
ValidationException
- when this Schema
definition
is invalid.public java.lang.String getNamespacePrefix(java.lang.String namespace)
protected Schema getMasterSchema()
protected void setMasterSchema(Schema masterSchema)
masterSchema
- the master schema in which this instance of schema
is used at runtime. This method is meant to be used at runtime.Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com