|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.saxonica.schema.SchemaStructure com.saxonica.schema.PreparedSchema
public class PreparedSchema
A schema is a collection of schema components. It may be derived from a single schema document (an xs:schema element), in which case it contains those components defined in that schema document, the components defined in the included documents (expanded transitively), and the components defined in imported schema documents (not expanded transitively). Alternatively, it may be a collection of schema components derived from multiple independent schema documents.
Constructor Summary | |
---|---|
PreparedSchema(SchemaAwareConfiguration config)
Create a new Schema definition |
Method Summary | |
---|---|
void |
addAnonymousType(SchemaType type)
Register an anonymous type defined in this schema |
void |
addAttributeDecl(AttributeDecl attribute)
Adds the given global attribute declaration to this Schema. |
void |
addAttributeGroup(AttributeGroupDecl attributeGroup)
Adds the given attribute group declaration to this Schema. |
void |
addComponent(UserSchemaComponent obj)
Add an object that might contain a forwards reference to be fixed up later |
void |
addElementDecl(ElementDecl elementDecl)
Adds the given global element declaration to this Schema definition |
void |
addGroup(ModelGroupDefinition group)
Adds the given group (xs:group) to this Schema. |
void |
addIdentityConstraint(IdentityConstraint constraint)
Add an identity constraint |
void |
addNotation(Notation notation)
Adds the given Notation declaration to this Schema defintion |
void |
addSimpleType(SimpleTypeDefinition simpleType)
Adds the given named SimpleType definition to this Schema. |
void |
addType(SchemaType type)
Adds the given type definition to this Schema. |
void |
copyTo(PreparedSchema destination,
SchemaCompiler compiler)
Copy the components of this schema to another schema |
AttributeDecl |
getAttributeDecl(int fingerprint)
Get the attribute declaration with a given name if there is one. |
AttributeGroupDecl |
getAttributeGroup(int fingerprint)
Get the attribute declaration with a given name if there is one. |
SchemaAwareConfiguration |
getConfiguration()
Get the configuration |
ElementDecl |
getElementDecl(int fingerprint)
Get the global element declaration with a given name |
ModelGroupDefinition |
getGroup(int fingerprint)
Get the model group with a given name if there is one. |
IdentityConstraint |
getIdentityConstraint(int fingerprint)
Get the identity constraint whose name has a given fingerprint |
NamePool |
getNamePool()
Get the NamePool used by this schema |
Notation |
getNotation(int fingerprint)
Get the notation with a given name |
String |
getSchemaLocation()
Returns the schemaLocation hint provided for this schema |
SchemaType |
getSchemaType(int fingerprint)
Get the type with a given name if there is one. |
SimpleType |
getSimpleType(int fingerprint)
Get the simple type with a given name if there is one. |
String |
getTargetNamespace()
Returns the target namespace for this Schema, or "" if the schema is a no-namespace schema. |
SchemaType |
getType(int fingerprint)
Get type defined in this schema, searching both named and anonymous types |
String |
getVersion()
Returns the version information of the XML Schema definition represented by this Schema instance. |
Iterator |
iterateAttributeDeclarations()
Get an iterator over all the global attribute declarations defined in this schema |
Iterator |
iterateAttributeGroups()
Get an iterator over all the named attribute groups defined in this schema |
Iterator |
iterateElementDeclarations()
Get an iterator over all the global element declarations defined in this schema. |
Iterator |
iterateIdentityConstraints()
Get an iterator over all the identity constraints defined in this schema (that is, unique, key, and keyref components). |
Iterator |
iterateModelGroups()
Get an iterator over all the named model groups defined in this schema |
Iterator |
iterateNotations()
Get an iterator over all the notations defined in this schema. |
Iterator |
iterateTypes()
Get an iterator over all the named simple and complex types defined in this schema. |
static PreparedSchema |
merge(PreparedSchema ps1,
PreparedSchema ps2)
Merge two PreparedSchemas into one, rejecting any components that are defined in both. |
void |
setConfiguration(SchemaAwareConfiguration config)
Set the configuration |
void |
setSchemaLocation(String schemaLocation)
Set the schemaLocation for this schema. |
void |
setTargetNamespace(String targetNamespace)
Sets the target namespace for this Schema |
void |
setVersion(String version)
Sets the version information for the XML Schema defintion represented by this Schema instance. |
boolean |
validate(SchemaCompiler compiler)
Checks the validity of this Schema definition, and if valid, adds the schema to the cache held by the SchemaAwareConfiguration |
static SchemaComponent |
validateReference(ComponentReference ref,
SchemaCompiler compiler)
Helper method to validate that a reference to a schema component can be resolved |
Methods inherited from class com.saxonica.schema.SchemaStructure |
---|
elaborate, fixup, getColumnNumber, getFixupStatus, getLineNumber, getPublicId, getSystemId, getValidationStatus, lookForCycles, setFixupStatus, setLineNumber, setLocator, setSystemId, setValidationStatus |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PreparedSchema(SchemaAwareConfiguration config)
config
- The configuration object holding system configuration informationMethod Detail |
---|
public void setConfiguration(SchemaAwareConfiguration config)
setConfiguration
in class SchemaStructure
public SchemaAwareConfiguration getConfiguration()
getConfiguration
in class SchemaStructure
public void addComponent(UserSchemaComponent obj)
obj
- the component to be addedpublic AttributeDecl getAttributeDecl(int fingerprint)
fingerprint
- the fingerprint representing the name of the required attribute declaration
public Iterator iterateAttributeDeclarations()
AttributeDecl
public void addAttributeDecl(AttributeDecl attribute)
attribute
- the AttributeDecl to addpublic AttributeGroupDecl getAttributeGroup(int fingerprint)
fingerprint
- the fingerprint representing the name of the required attribute group
public Iterator iterateAttributeGroups()
AttributeGroupDecl
public void addAttributeGroup(AttributeGroupDecl attributeGroup)
attributeGroup
- the AttributeDecl to addpublic ModelGroupDefinition getGroup(int fingerprint)
fingerprint
- the fingerprint representing the name of the required named model group
public Iterator iterateModelGroups()
ModelGroupDefinition
public void addGroup(ModelGroupDefinition group)
group
- the group to addpublic SchemaType getSchemaType(int fingerprint)
fingerprint
- the fingerprint representing the name of the required schema type
public SimpleType getSimpleType(int fingerprint)
fingerprint
- the fingerprint representing the name of the required simple type
public Iterator iterateTypes()
SchemaType
public void addType(SchemaType type)
type
- the type to add to this Schemapublic void addAnonymousType(SchemaType type)
type
- the anonymous type to be addedpublic SchemaType getType(int fingerprint)
fingerprint
- the fingerprint representing the name of the required schema type
public void addElementDecl(ElementDecl elementDecl) throws SchemaException
elementDecl
- the ElementDecl to add to this Schema
SchemaException
public ElementDecl getElementDecl(int fingerprint)
fingerprint
- identifies the name of the element
public Iterator iterateElementDeclarations()
ElementDecl
public void addNotation(Notation notation) throws SchemaException
notation
- the Notation to add to this Schema
SchemaException
public Notation getNotation(int fingerprint)
fingerprint
- identifies the name of the notation
public Iterator iterateNotations()
Notation
public void addSimpleType(SimpleTypeDefinition simpleType) throws SchemaException
simpleType
- the SimpleType to add to this Schema
SchemaException
- if the SimpleType does not have
a namepublic void addIdentityConstraint(IdentityConstraint constraint)
constraint
- the identity constraint to be addedpublic IdentityConstraint getIdentityConstraint(int fingerprint)
fingerprint
- the fingerprint representing the name of the required constraint
public Iterator iterateIdentityConstraints()
IdentityConstraint
public String getTargetNamespace()
public String getVersion()
public NamePool getNamePool()
public String getSchemaLocation()
public void setSchemaLocation(String schemaLocation)
schemaLocation
- the location hint for this Schemapublic void setTargetNamespace(String targetNamespace)
targetNamespace
- the target namespace for this Schemapublic void setVersion(String version)
version
- the version for this XML Schema defination.public void copyTo(PreparedSchema destination, SchemaCompiler compiler) throws SchemaException
destination
- the destination of the copycompiler
- used for error reporting
SchemaException
- if there are name clashes between this
schema and the destination schemapublic boolean validate(SchemaCompiler compiler) throws SchemaException, ValidationException
compiler
- a SchemaCompiler to which all errors should be reported
SchemaException
- if the SchemaCompiler decides that an error is fatal
ValidationException
public static SchemaComponent validateReference(ComponentReference ref, SchemaCompiler compiler) throws SchemaException
ref
- The Component reference that needs to be resolvedcompiler
- used for error reporting
SchemaException
- if the reference cannot be resolvedpublic static PreparedSchema merge(PreparedSchema ps1, PreparedSchema ps2) throws SchemaException
ps1
- the first PreparedSchemaps2
- the second PreparedSchema
SchemaException
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |