Class SchemaGrammar
- java.lang.Object
-
- org.smooks.engine.delivery.sax.ng.org.apache.xerces.impl.xs.SchemaGrammar
-
- All Implemented Interfaces:
Grammar
,XSGrammar
,XSNamespaceItem
- Direct Known Subclasses:
SchemaGrammar.BuiltinSchemaGrammar
,SchemaGrammar.Schema4Annotations
public class SchemaGrammar extends Object implements XSGrammar, XSNamespaceItem
This class is to hold all schema component declaration that are declared within one namespace. The Grammar class this class extends contains what little commonality there is between XML Schema and DTD grammars. It's useful to distinguish grammar objects from other kinds of object when they exist in pools or caches.- Version:
- $Id$
- Author:
- Sandy Gao, IBM, Elena Litani, IBM
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SchemaGrammar.BuiltinSchemaGrammar
static class
SchemaGrammar.Schema4Annotations
A partial schema for schemas for validating annotations.
-
Field Summary
Fields Modifier and Type Field Description static XSSimpleType
fAnySimpleType
static XSComplexTypeDecl
fAnyType
static SchemaGrammar.BuiltinSchemaGrammar
SG_SchemaNS
static SchemaGrammar.BuiltinSchemaGrammar
SG_XSI
-
Constructor Summary
Constructors Modifier Constructor Description protected
SchemaGrammar()
SchemaGrammar(String targetNamespace, XSDDescription grammarDesc, SymbolTable symbolTable)
Default constructor.SchemaGrammar(SchemaGrammar grammar)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAnnotation(XSAnnotationImpl annotation)
void
addComplexTypeDecl(XSComplexTypeDecl decl, SimpleLocator locator)
add one complex type decl: for later constraint checkingvoid
addDocument(Object document, String location)
void
addGlobalAttributeDecl(XSAttributeDecl decl)
register one global attributevoid
addGlobalAttributeDecl(XSAttributeDecl decl, String location)
void
addGlobalAttributeGroupDecl(XSAttributeGroupDecl decl)
register one global attribute groupvoid
addGlobalAttributeGroupDecl(XSAttributeGroupDecl decl, String location)
void
addGlobalComplexTypeDecl(XSComplexTypeDecl decl)
register one global complex typevoid
addGlobalComplexTypeDecl(XSComplexTypeDecl decl, String location)
void
addGlobalElementDecl(XSElementDecl decl)
void
addGlobalElementDecl(XSElementDecl decl, String location)
void
addGlobalElementDeclAll(XSElementDecl decl)
register one global elementvoid
addGlobalGroupDecl(XSGroupDecl decl)
register one global groupvoid
addGlobalGroupDecl(XSGroupDecl decl, String location)
void
addGlobalNotationDecl(XSNotationDecl decl)
register one global notationvoid
addGlobalNotationDecl(XSNotationDecl decl, String location)
void
addGlobalSimpleTypeDecl(XSSimpleType decl)
register one global simple typevoid
addGlobalSimpleTypeDecl(XSSimpleType decl, String location)
void
addGlobalTypeDecl(XSTypeDefinition decl)
register one global typevoid
addGlobalTypeDecl(XSTypeDefinition decl, String location)
void
addIDConstraintDecl(XSElementDecl elmDecl, IdentityConstraint decl)
register one identity constraintvoid
addIDConstraintDecl(XSElementDecl elmDecl, IdentityConstraint decl, String location)
void
addRedefinedGroupDecl(XSGroupDecl derived, XSGroupDecl base, SimpleLocator locator)
add a group redefined by restriction: for later constraint checkingXSObjectList
getAnnotations()
[annotations]: a set of annotations if it exists, otherwise an emptyXSObjectList
.XSAttributeDeclaration
getAttributeDeclaration(String name)
Convenience method.XSAttributeGroupDefinition
getAttributeGroup(String name)
Convenience method.XSNamedMap
getComponents(short objectType)
[schema components]: a list of top-level components, i.e.ObjectList
getComponentsExt(short objectType)
StringList
getDocumentLocations()
[document location]XSElementDeclaration
getElementDeclaration(String name)
Convenience method.XSAttributeDecl
getGlobalAttributeDecl(String declName)
get one global attributeXSAttributeDecl
getGlobalAttributeDecl(String declName, String location)
XSAttributeGroupDecl
getGlobalAttributeGroupDecl(String declName)
get one global attribute groupXSAttributeGroupDecl
getGlobalAttributeGroupDecl(String declName, String location)
XSElementDecl
getGlobalElementDecl(String declName)
get one global elementXSElementDecl
getGlobalElementDecl(String declName, String location)
XSGroupDecl
getGlobalGroupDecl(String declName)
get one global groupXSGroupDecl
getGlobalGroupDecl(String declName, String location)
XSNotationDecl
getGlobalNotationDecl(String declName)
get one global notationXSNotationDecl
getGlobalNotationDecl(String declName, String location)
XSTypeDefinition
getGlobalTypeDecl(String declName)
get one global typeXSTypeDefinition
getGlobalTypeDecl(String declName, String location)
XMLGrammarDescription
getGrammarDescription()
get theXMLGrammarDescription
associated with this objectXSIDCDefinition
getIDCDefinition(String name)
Convenience method.IdentityConstraint
getIDConstraintDecl(String declName)
get one identity constraintIdentityConstraint
getIDConstraintDecl(String declName, String location)
Vector
getImportedGrammars()
XSModelGroupDefinition
getModelGroupDefinition(String name)
Convenience method.XSNotationDeclaration
getNotationDeclaration(String name)
Convenience method.static SchemaGrammar
getS4SGrammar(short schemaVersion)
String
getSchemaNamespace()
[schema namespace]String
getTargetNamespace()
Returns this grammar's target namespace.XSTypeDefinition
getTypeDefinition(String name)
Convenience method.boolean
hasIDConstraints()
get one identity constraintboolean
isImmutable()
boolean
isNamespaceAware()
void
removeDocument(int index)
void
resetComponents()
void
setImmutable(boolean isImmutable)
void
setImportedGrammars(Vector importedGrammars)
XSModel
toXSModel()
Return anXSModel
that represents components in this schema grammar.XSModel
toXSModel(XSGrammar[] grammars)
Return anXSModel
that represents components in this schema grammar and the grammars in thegrammars
parameter, any schema grammars that are imported by them directly or indirectly.
-
-
-
Field Detail
-
fAnyType
public static final XSComplexTypeDecl fAnyType
-
SG_SchemaNS
public static final SchemaGrammar.BuiltinSchemaGrammar SG_SchemaNS
-
fAnySimpleType
public static final XSSimpleType fAnySimpleType
-
SG_XSI
public static final SchemaGrammar.BuiltinSchemaGrammar SG_XSI
-
-
Constructor Detail
-
SchemaGrammar
protected SchemaGrammar()
-
SchemaGrammar
public SchemaGrammar(String targetNamespace, XSDDescription grammarDesc, SymbolTable symbolTable)
Default constructor.- Parameters:
targetNamespace
-grammarDesc
- the XMLGrammarDescription corresponding to this objec at the least a systemId should always be known.symbolTable
- needed for annotation support
-
SchemaGrammar
public SchemaGrammar(SchemaGrammar grammar)
-
-
Method Detail
-
getGrammarDescription
public XMLGrammarDescription getGrammarDescription()
Description copied from interface:Grammar
get theXMLGrammarDescription
associated with this object- Specified by:
getGrammarDescription
in interfaceGrammar
-
isNamespaceAware
public boolean isNamespaceAware()
-
setImportedGrammars
public void setImportedGrammars(Vector importedGrammars)
-
getImportedGrammars
public Vector getImportedGrammars()
-
getTargetNamespace
public final String getTargetNamespace()
Returns this grammar's target namespace.
-
addGlobalAttributeDecl
public void addGlobalAttributeDecl(XSAttributeDecl decl)
register one global attribute
-
addGlobalAttributeDecl
public void addGlobalAttributeDecl(XSAttributeDecl decl, String location)
-
addGlobalAttributeGroupDecl
public void addGlobalAttributeGroupDecl(XSAttributeGroupDecl decl)
register one global attribute group
-
addGlobalAttributeGroupDecl
public void addGlobalAttributeGroupDecl(XSAttributeGroupDecl decl, String location)
-
addGlobalElementDeclAll
public void addGlobalElementDeclAll(XSElementDecl decl)
register one global element
-
addGlobalElementDecl
public void addGlobalElementDecl(XSElementDecl decl)
-
addGlobalElementDecl
public void addGlobalElementDecl(XSElementDecl decl, String location)
-
addGlobalGroupDecl
public void addGlobalGroupDecl(XSGroupDecl decl)
register one global group
-
addGlobalGroupDecl
public void addGlobalGroupDecl(XSGroupDecl decl, String location)
-
addGlobalNotationDecl
public void addGlobalNotationDecl(XSNotationDecl decl)
register one global notation
-
addGlobalNotationDecl
public void addGlobalNotationDecl(XSNotationDecl decl, String location)
-
addGlobalTypeDecl
public void addGlobalTypeDecl(XSTypeDefinition decl)
register one global type
-
addGlobalTypeDecl
public void addGlobalTypeDecl(XSTypeDefinition decl, String location)
-
addGlobalComplexTypeDecl
public void addGlobalComplexTypeDecl(XSComplexTypeDecl decl)
register one global complex type
-
addGlobalComplexTypeDecl
public void addGlobalComplexTypeDecl(XSComplexTypeDecl decl, String location)
-
addGlobalSimpleTypeDecl
public void addGlobalSimpleTypeDecl(XSSimpleType decl)
register one global simple type
-
addGlobalSimpleTypeDecl
public void addGlobalSimpleTypeDecl(XSSimpleType decl, String location)
-
addIDConstraintDecl
public final void addIDConstraintDecl(XSElementDecl elmDecl, IdentityConstraint decl)
register one identity constraint
-
addIDConstraintDecl
public final void addIDConstraintDecl(XSElementDecl elmDecl, IdentityConstraint decl, String location)
-
getGlobalAttributeDecl
public final XSAttributeDecl getGlobalAttributeDecl(String declName)
get one global attribute
-
getGlobalAttributeDecl
public final XSAttributeDecl getGlobalAttributeDecl(String declName, String location)
-
getGlobalAttributeGroupDecl
public final XSAttributeGroupDecl getGlobalAttributeGroupDecl(String declName)
get one global attribute group
-
getGlobalAttributeGroupDecl
public final XSAttributeGroupDecl getGlobalAttributeGroupDecl(String declName, String location)
-
getGlobalElementDecl
public final XSElementDecl getGlobalElementDecl(String declName)
get one global element
-
getGlobalElementDecl
public final XSElementDecl getGlobalElementDecl(String declName, String location)
-
getGlobalGroupDecl
public final XSGroupDecl getGlobalGroupDecl(String declName)
get one global group
-
getGlobalGroupDecl
public final XSGroupDecl getGlobalGroupDecl(String declName, String location)
-
getGlobalNotationDecl
public final XSNotationDecl getGlobalNotationDecl(String declName)
get one global notation
-
getGlobalNotationDecl
public final XSNotationDecl getGlobalNotationDecl(String declName, String location)
-
getGlobalTypeDecl
public final XSTypeDefinition getGlobalTypeDecl(String declName)
get one global type
-
getGlobalTypeDecl
public final XSTypeDefinition getGlobalTypeDecl(String declName, String location)
-
getIDConstraintDecl
public final IdentityConstraint getIDConstraintDecl(String declName)
get one identity constraint
-
getIDConstraintDecl
public final IdentityConstraint getIDConstraintDecl(String declName, String location)
-
hasIDConstraints
public final boolean hasIDConstraints()
get one identity constraint
-
addComplexTypeDecl
public void addComplexTypeDecl(XSComplexTypeDecl decl, SimpleLocator locator)
add one complex type decl: for later constraint checking
-
addRedefinedGroupDecl
public void addRedefinedGroupDecl(XSGroupDecl derived, XSGroupDecl base, SimpleLocator locator)
add a group redefined by restriction: for later constraint checking
-
getS4SGrammar
public static SchemaGrammar getS4SGrammar(short schemaVersion)
-
removeDocument
public void removeDocument(int index)
-
getSchemaNamespace
public String getSchemaNamespace()
[schema namespace]- Specified by:
getSchemaNamespace
in interfaceXSNamespaceItem
- Returns:
- The target namespace of this item.
- See Also:
- [schema namespace]
-
getComponents
public XSNamedMap getComponents(short objectType)
[schema components]: a list of top-level components, i.e. element declarations, attribute declarations, etc.- Specified by:
getComponents
in interfaceXSNamespaceItem
- Parameters:
objectType
- The type of the declaration, i.e.ELEMENT_DECLARATION
. Note thatXSTypeDefinition.SIMPLE_TYPE
andXSTypeDefinition.COMPLEX_TYPE
can also be used as theobjectType
to retrieve only complex types or simple types, instead of all types.- Returns:
- A list of top-level definition of the specified type in
objectType
or an emptyXSNamedMap
if no such definitions exist.
-
getComponentsExt
public ObjectList getComponentsExt(short objectType)
-
resetComponents
public void resetComponents()
-
getTypeDefinition
public XSTypeDefinition getTypeDefinition(String name)
Convenience method. Returns a top-level simple or complex type definition.- Specified by:
getTypeDefinition
in interfaceXSNamespaceItem
- Parameters:
name
- The name of the definition.- Returns:
- An
XSTypeDefinition
or null if such definition does not exist.
-
getAttributeDeclaration
public XSAttributeDeclaration getAttributeDeclaration(String name)
Convenience method. Returns a top-level attribute declaration.- Specified by:
getAttributeDeclaration
in interfaceXSNamespaceItem
- Parameters:
name
- The name of the declaration.- Returns:
- A top-level attribute declaration or null if such declaration does not exist.
-
getElementDeclaration
public XSElementDeclaration getElementDeclaration(String name)
Convenience method. Returns a top-level element declaration.- Specified by:
getElementDeclaration
in interfaceXSNamespaceItem
- Parameters:
name
- The name of the declaration.- Returns:
- A top-level element declaration or null if such declaration does not exist.
-
getAttributeGroup
public XSAttributeGroupDefinition getAttributeGroup(String name)
Convenience method. Returns a top-level attribute group definition.- Specified by:
getAttributeGroup
in interfaceXSNamespaceItem
- Parameters:
name
- The name of the definition.- Returns:
- A top-level attribute group definition or null if such definition does not exist.
-
getModelGroupDefinition
public XSModelGroupDefinition getModelGroupDefinition(String name)
Convenience method. Returns a top-level model group definition.- Specified by:
getModelGroupDefinition
in interfaceXSNamespaceItem
- Parameters:
name
- The name of the definition.- Returns:
- A top-level model group definition definition or null if such definition does not exist.
-
getNotationDeclaration
public XSNotationDeclaration getNotationDeclaration(String name)
Convenience method. Returns a top-level notation declaration.- Specified by:
getNotationDeclaration
in interfaceXSNamespaceItem
- Parameters:
name
- The name of the declaration.- Returns:
- A top-level notation declaration or null if such declaration does not exist.
-
getIDCDefinition
public XSIDCDefinition getIDCDefinition(String name)
Description copied from interface:XSNamespaceItem
Convenience method. Returns an identity-constraint definition.- Specified by:
getIDCDefinition
in interfaceXSNamespaceItem
- Parameters:
name
- The name of the definition.- Returns:
- An identity-constraint definition or
null
if such a declaration does not exist.
-
getDocumentLocations
public StringList getDocumentLocations()
[document location]- Specified by:
getDocumentLocations
in interfaceXSNamespaceItem
- Returns:
- a list of document information item
- See Also:
- [document location]
-
toXSModel
public XSModel toXSModel()
Return anXSModel
that represents components in this schema grammar.
-
toXSModel
public XSModel toXSModel(XSGrammar[] grammars)
Description copied from interface:XSGrammar
Return anXSModel
that represents components in this schema grammar and the grammars in thegrammars
parameter, any schema grammars that are imported by them directly or indirectly.
-
getAnnotations
public XSObjectList getAnnotations()
Description copied from interface:XSNamespaceItem
[annotations]: a set of annotations if it exists, otherwise an emptyXSObjectList
.- Specified by:
getAnnotations
in interfaceXSNamespaceItem
- See Also:
XSNamespaceItem.getAnnotations()
-
addAnnotation
public void addAnnotation(XSAnnotationImpl annotation)
-
setImmutable
public void setImmutable(boolean isImmutable)
-
isImmutable
public boolean isImmutable()
-
-