Package org.apache.xerces.impl.xs
Class SchemaGrammar
java.lang.Object
org.apache.xerces.impl.xs.SchemaGrammar
- All Implemented Interfaces:
org.apache.xerces.xni.grammars.Grammar
,org.apache.xerces.xni.grammars.XSGrammar
,org.apache.xerces.xs.XSNamespaceItem
- Direct Known Subclasses:
SchemaGrammar.BuiltinSchemaGrammar
,SchemaGrammar.Schema4Annotations
public class SchemaGrammar
extends Object
implements org.apache.xerces.xni.grammars.XSGrammar, org.apache.xerces.xs.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.
INTERNAL:
- Usage of this class is not supported. It may be altered or removed at any time.
- Version:
- $Id: SchemaGrammar.java 1082533 2011-03-17 15:22:26Z knoaman $
- Author:
- Sandy Gao, IBM, Elena Litani, IBM
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static final class
A partial schema for schemas for validating annotations. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final XSSimpleType
static final XSComplexTypeDecl
static final SchemaGrammar.BuiltinSchemaGrammar
static final SchemaGrammar.BuiltinSchemaGrammar
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
SchemaGrammar
(String targetNamespace, XSDDescription grammarDesc, SymbolTable symbolTable) Default constructor.SchemaGrammar
(SchemaGrammar grammar) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAnnotation
(XSAnnotationImpl annotation) void
addComplexTypeDecl
(XSComplexTypeDecl decl, SimpleLocator locator) add one complex type decl: for later constraint checkingvoid
addDocument
(Object document, String location) void
register one global attributevoid
addGlobalAttributeDecl
(XSAttributeDecl decl, String location) void
register one global attribute groupvoid
addGlobalAttributeGroupDecl
(XSAttributeGroupDecl decl, String location) void
register one global complex typevoid
addGlobalComplexTypeDecl
(XSComplexTypeDecl decl, String location) void
void
addGlobalElementDecl
(XSElementDecl decl, String location) void
register one global elementvoid
register one global groupvoid
addGlobalGroupDecl
(XSGroupDecl decl, String location) void
register one global notationvoid
addGlobalNotationDecl
(XSNotationDecl decl, String location) void
register one global simple typevoid
addGlobalSimpleTypeDecl
(XSSimpleType decl, String location) void
addGlobalTypeDecl
(org.apache.xerces.xs.XSTypeDefinition decl) register one global typevoid
addGlobalTypeDecl
(org.apache.xerces.xs.XSTypeDefinition decl, String location) final void
addIDConstraintDecl
(XSElementDecl elmDecl, IdentityConstraint decl) register one identity constraintfinal void
addIDConstraintDecl
(XSElementDecl elmDecl, IdentityConstraint decl, String location) void
addRedefinedGroupDecl
(XSGroupDecl derived, XSGroupDecl base, SimpleLocator locator) add a group redefined by restriction: for later constraint checkingorg.apache.xerces.xs.XSObjectList
[annotations]: a set of annotations if it exists, otherwise an emptyXSObjectList
.org.apache.xerces.xs.XSAttributeDeclaration
Convenience method.org.apache.xerces.xs.XSAttributeGroupDefinition
getAttributeGroup
(String name) Convenience method.org.apache.xerces.xs.XSNamedMap
getComponents
(short objectType) [schema components]: a list of top-level components, i.e.org.apache.xerces.xs.datatypes.ObjectList
getComponentsExt
(short objectType) org.apache.xerces.xs.StringList
[document location]org.apache.xerces.xs.XSElementDeclaration
getElementDeclaration
(String name) Convenience method.final XSAttributeDecl
getGlobalAttributeDecl
(String declName) get one global attributefinal XSAttributeDecl
getGlobalAttributeDecl
(String declName, String location) final XSAttributeGroupDecl
getGlobalAttributeGroupDecl
(String declName) get one global attribute groupfinal XSAttributeGroupDecl
getGlobalAttributeGroupDecl
(String declName, String location) final XSElementDecl
getGlobalElementDecl
(String declName) get one global elementfinal XSElementDecl
getGlobalElementDecl
(String declName, String location) final XSGroupDecl
getGlobalGroupDecl
(String declName) get one global groupfinal XSGroupDecl
getGlobalGroupDecl
(String declName, String location) final XSNotationDecl
getGlobalNotationDecl
(String declName) get one global notationfinal XSNotationDecl
getGlobalNotationDecl
(String declName, String location) final org.apache.xerces.xs.XSTypeDefinition
getGlobalTypeDecl
(String declName) get one global typefinal org.apache.xerces.xs.XSTypeDefinition
getGlobalTypeDecl
(String declName, String location) org.apache.xerces.xni.grammars.XMLGrammarDescription
get theXMLGrammarDescription
associated with this objectorg.apache.xerces.xs.XSIDCDefinition
getIDCDefinition
(String name) Convenience method.final IdentityConstraint
getIDConstraintDecl
(String declName) get one identity constraintfinal IdentityConstraint
getIDConstraintDecl
(String declName, String location) org.apache.xerces.xs.XSModelGroupDefinition
Convenience method.org.apache.xerces.xs.XSNotationDeclaration
getNotationDeclaration
(String name) Convenience method.static SchemaGrammar
getS4SGrammar
(short schemaVersion) [schema namespace]final String
Returns this grammar's target namespace.org.apache.xerces.xs.XSTypeDefinition
getTypeDefinition
(String name) Convenience method.final boolean
get one identity constraintboolean
boolean
void
removeDocument
(int index) void
void
setImmutable
(boolean isImmutable) void
setImportedGrammars
(Vector importedGrammars) org.apache.xerces.xs.XSModel
Return anXSModel
that represents components in this schema grammar.org.apache.xerces.xs.XSModel
toXSModel
(org.apache.xerces.xni.grammars.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 Details
-
fAnyType
-
SG_SchemaNS
-
fAnySimpleType
-
SG_XSI
-
-
Constructor Details
-
SchemaGrammar
protected SchemaGrammar() -
SchemaGrammar
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
-
-
Method Details
-
getGrammarDescription
public org.apache.xerces.xni.grammars.XMLGrammarDescription getGrammarDescription()Description copied from interface:org.apache.xerces.xni.grammars.Grammar
get theXMLGrammarDescription
associated with this object- Specified by:
getGrammarDescription
in interfaceorg.apache.xerces.xni.grammars.Grammar
-
isNamespaceAware
public boolean isNamespaceAware() -
setImportedGrammars
-
getImportedGrammars
-
getTargetNamespace
Returns this grammar's target namespace. -
addGlobalAttributeDecl
register one global attribute -
addGlobalAttributeDecl
-
addGlobalAttributeGroupDecl
register one global attribute group -
addGlobalAttributeGroupDecl
-
addGlobalElementDeclAll
register one global element -
addGlobalElementDecl
-
addGlobalElementDecl
-
addGlobalGroupDecl
register one global group -
addGlobalGroupDecl
-
addGlobalNotationDecl
register one global notation -
addGlobalNotationDecl
-
addGlobalTypeDecl
public void addGlobalTypeDecl(org.apache.xerces.xs.XSTypeDefinition decl) register one global type -
addGlobalTypeDecl
-
addGlobalComplexTypeDecl
register one global complex type -
addGlobalComplexTypeDecl
-
addGlobalSimpleTypeDecl
register one global simple type -
addGlobalSimpleTypeDecl
-
addIDConstraintDecl
register one identity constraint -
addIDConstraintDecl
public final void addIDConstraintDecl(XSElementDecl elmDecl, IdentityConstraint decl, String location) -
getGlobalAttributeDecl
get one global attribute -
getGlobalAttributeDecl
-
getGlobalAttributeGroupDecl
get one global attribute group -
getGlobalAttributeGroupDecl
-
getGlobalElementDecl
get one global element -
getGlobalElementDecl
-
getGlobalGroupDecl
get one global group -
getGlobalGroupDecl
-
getGlobalNotationDecl
get one global notation -
getGlobalNotationDecl
-
getGlobalTypeDecl
get one global type -
getGlobalTypeDecl
-
getIDConstraintDecl
get one identity constraint -
getIDConstraintDecl
-
hasIDConstraints
public final boolean hasIDConstraints()get one identity constraint -
addComplexTypeDecl
add one complex type decl: for later constraint checking -
addRedefinedGroupDecl
add a group redefined by restriction: for later constraint checking -
getS4SGrammar
-
addDocument
-
removeDocument
public void removeDocument(int index) -
getSchemaNamespace
[schema namespace]- Specified by:
getSchemaNamespace
in interfaceorg.apache.xerces.xs.XSNamespaceItem
- Returns:
- The target namespace of this item.
- See Also:
-
getComponents
public org.apache.xerces.xs.XSNamedMap getComponents(short objectType) [schema components]: a list of top-level components, i.e. element declarations, attribute declarations, etc.- Specified by:
getComponents
in interfaceorg.apache.xerces.xs.XSNamespaceItem
- 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 org.apache.xerces.xs.datatypes.ObjectList getComponentsExt(short objectType) -
resetComponents
public void resetComponents() -
getTypeDefinition
Convenience method. Returns a top-level simple or complex type definition.- Specified by:
getTypeDefinition
in interfaceorg.apache.xerces.xs.XSNamespaceItem
- Parameters:
name
- The name of the definition.- Returns:
- An
XSTypeDefinition
or null if such definition does not exist.
-
getAttributeDeclaration
Convenience method. Returns a top-level attribute declaration.- Specified by:
getAttributeDeclaration
in interfaceorg.apache.xerces.xs.XSNamespaceItem
- Parameters:
name
- The name of the declaration.- Returns:
- A top-level attribute declaration or null if such declaration does not exist.
-
getElementDeclaration
Convenience method. Returns a top-level element declaration.- Specified by:
getElementDeclaration
in interfaceorg.apache.xerces.xs.XSNamespaceItem
- Parameters:
name
- The name of the declaration.- Returns:
- A top-level element declaration or null if such declaration does not exist.
-
getAttributeGroup
Convenience method. Returns a top-level attribute group definition.- Specified by:
getAttributeGroup
in interfaceorg.apache.xerces.xs.XSNamespaceItem
- Parameters:
name
- The name of the definition.- Returns:
- A top-level attribute group definition or null if such definition does not exist.
-
getModelGroupDefinition
Convenience method. Returns a top-level model group definition.- Specified by:
getModelGroupDefinition
in interfaceorg.apache.xerces.xs.XSNamespaceItem
- Parameters:
name
- The name of the definition.- Returns:
- A top-level model group definition definition or null if such definition does not exist.
-
getNotationDeclaration
Convenience method. Returns a top-level notation declaration.- Specified by:
getNotationDeclaration
in interfaceorg.apache.xerces.xs.XSNamespaceItem
- Parameters:
name
- The name of the declaration.- Returns:
- A top-level notation declaration or null if such declaration does not exist.
-
getIDCDefinition
Description copied from interface:org.apache.xerces.xs.XSNamespaceItem
Convenience method. Returns an identity-constraint definition.- Specified by:
getIDCDefinition
in interfaceorg.apache.xerces.xs.XSNamespaceItem
- Parameters:
name
- The name of the definition.- Returns:
- An identity-constraint definition or
null
if such a declaration does not exist.
-
getDocumentLocations
public org.apache.xerces.xs.StringList getDocumentLocations()[document location]- Specified by:
getDocumentLocations
in interfaceorg.apache.xerces.xs.XSNamespaceItem
- Returns:
- a list of document information item
- See Also:
-
toXSModel
public org.apache.xerces.xs.XSModel toXSModel()Return anXSModel
that represents components in this schema grammar.- Specified by:
toXSModel
in interfaceorg.apache.xerces.xni.grammars.XSGrammar
- Returns:
- an
XSModel
representing this schema grammar
-
toXSModel
public org.apache.xerces.xs.XSModel toXSModel(org.apache.xerces.xni.grammars.XSGrammar[] grammars) Description copied from interface:org.apache.xerces.xni.grammars.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.- Specified by:
toXSModel
in interfaceorg.apache.xerces.xni.grammars.XSGrammar
- Returns:
- an
XSModel
representing these schema grammars
-
getAnnotations
public org.apache.xerces.xs.XSObjectList getAnnotations()Description copied from interface:org.apache.xerces.xs.XSNamespaceItem
[annotations]: a set of annotations if it exists, otherwise an emptyXSObjectList
.- Specified by:
getAnnotations
in interfaceorg.apache.xerces.xs.XSNamespaceItem
- See Also:
-
addAnnotation
-
setImmutable
public void setImmutable(boolean isImmutable) -
isImmutable
public boolean isImmutable()
-