org.apache.xerces.impl.xs

Class SchemaGrammar

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.

INTERNAL:

Usage of this class is not supported. It may be altered or removed at any time.

Version: $Id: SchemaGrammar.java,v 1.42 2004/12/15 23:48:48 mrglavas Exp $

Author: Sandy Gao, IBM Elena Litani, IBM

Nested Class Summary
static classSchemaGrammar.BuiltinSchemaGrammar
static classSchemaGrammar.Schema4Annotations

A partial schema for schemas for validating annotations.

INTERNAL:

Usage of this class is not supported.
Field Summary
static XSSimpleTypefAnySimpleType
static XSComplexTypeDeclfAnyType
static SchemaGrammar.Schema4AnnotationsSG_Schema4Annotations
static SchemaGrammar.BuiltinSchemaGrammarSG_SchemaNS
static SchemaGrammar.BuiltinSchemaGrammarSG_XSI
Constructor Summary
protected SchemaGrammar()
SchemaGrammar(String targetNamespace, XSDDescription grammarDesc, SymbolTable symbolTable)
Default constructor.
Method Summary
voidaddAnnotation(XSAnnotationImpl annotation)
voidaddComplexTypeDecl(XSComplexTypeDecl decl, SimpleLocator locator)
add one complex type decl: for later constraint checking
voidaddDocument(Object document, String location)
voidaddGlobalAttributeDecl(XSAttributeDecl decl)
register one global attribute
voidaddGlobalAttributeGroupDecl(XSAttributeGroupDecl decl)
register one global attribute group
voidaddGlobalElementDecl(XSElementDecl decl)
register one global element
voidaddGlobalGroupDecl(XSGroupDecl decl)
register one global group
voidaddGlobalNotationDecl(XSNotationDecl decl)
register one global notation
voidaddGlobalTypeDecl(XSTypeDefinition decl)
register one global type
voidaddIDConstraintDecl(XSElementDecl elmDecl, IdentityConstraint decl)
register one identity constraint
voidaddRedefinedGroupDecl(XSGroupDecl derived, XSGroupDecl base, SimpleLocator locator)
add a group redefined by restriction: for later constraint checking
XSObjectListgetAnnotations()
XSAttributeDeclarationgetAttributeDeclaration(String name)
Convenience method.
XSAttributeGroupDefinitiongetAttributeGroup(String name)
Convenience method.
XSNamedMapgetComponents(short objectType)
[schema components]: a list of top-level components, i.e. element declarations, attribute declarations, etc.
StringListgetDocumentLocations()
[document location]
XSElementDeclarationgetElementDeclaration(String name)
Convenience method.
XSAttributeDeclgetGlobalAttributeDecl(String declName)
get one global attribute
XSAttributeGroupDeclgetGlobalAttributeGroupDecl(String declName)
get one global attribute group
XSElementDeclgetGlobalElementDecl(String declName)
get one global element
XSGroupDeclgetGlobalGroupDecl(String declName)
get one global group
XSNotationDeclgetGlobalNotationDecl(String declName)
get one global notation
XSTypeDefinitiongetGlobalTypeDecl(String declName)
get one global type
XMLGrammarDescriptiongetGrammarDescription()
IdentityConstraintgetIDConstraintDecl(String declName)
get one identity constraint
VectorgetImportedGrammars()
XSModelGroupDefinitiongetModelGroupDefinition(String name)
Convenience method.
XSNotationDeclarationgetNotationDeclaration(String name)
Convenience method.
StringgetSchemaNamespace()
[schema namespace]
StringgetTargetNamespace()
Returns this grammar's target namespace.
XSTypeDefinitiongetTypeDefinition(String name)
Convenience method.
booleanhasIDConstraints()
get one identity constraint
booleanisNamespaceAware()
voidsetImportedGrammars(Vector importedGrammars)
XSModeltoXSModel()
Return an XSModel that represents components in this schema grammar.
XSModeltoXSModel(XSGrammar[] grammars)

Field Detail

fAnySimpleType

public static final XSSimpleType fAnySimpleType

fAnyType

public static final XSComplexTypeDecl fAnyType

SG_Schema4Annotations

public static final SchemaGrammar.Schema4Annotations SG_Schema4Annotations

SG_SchemaNS

public static final SchemaGrammar.BuiltinSchemaGrammar SG_SchemaNS

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

Method Detail

addAnnotation

public void addAnnotation(XSAnnotationImpl annotation)

addComplexTypeDecl

public void addComplexTypeDecl(XSComplexTypeDecl decl, SimpleLocator locator)
add one complex type decl: for later constraint checking

addDocument

public void addDocument(Object document, String location)

addGlobalAttributeDecl

public void addGlobalAttributeDecl(XSAttributeDecl decl)
register one global attribute

addGlobalAttributeGroupDecl

public void addGlobalAttributeGroupDecl(XSAttributeGroupDecl decl)
register one global attribute group

addGlobalElementDecl

public void addGlobalElementDecl(XSElementDecl decl)
register one global element

addGlobalGroupDecl

public void addGlobalGroupDecl(XSGroupDecl decl)
register one global group

addGlobalNotationDecl

public void addGlobalNotationDecl(XSNotationDecl decl)
register one global notation

addGlobalTypeDecl

public void addGlobalTypeDecl(XSTypeDefinition decl)
register one global type

addIDConstraintDecl

public final void addIDConstraintDecl(XSElementDecl elmDecl, IdentityConstraint decl)
register one identity constraint

addRedefinedGroupDecl

public void addRedefinedGroupDecl(XSGroupDecl derived, XSGroupDecl base, SimpleLocator locator)
add a group redefined by restriction: for later constraint checking

getAnnotations

public XSObjectList getAnnotations()

See Also: org.apache.xerces.xs.XSNamespaceItem#getAnnotations()

getAttributeDeclaration

public XSAttributeDeclaration getAttributeDeclaration(String name)
Convenience method. Returns a top-level attribute declaration.

Parameters: name The name of the declaration.

Returns: A top-level attribute declaration or null if such declaration does not exist.

getAttributeGroup

public XSAttributeGroupDefinition getAttributeGroup(String name)
Convenience method. Returns a top-level attribute group definition.

Parameters: name The name of the definition.

Returns: A top-level attribute group definition or null if such definition does not exist.

getComponents

public XSNamedMap getComponents(short objectType)
[schema components]: a list of top-level components, i.e. element declarations, attribute declarations, etc.

Parameters: objectType The type of the declaration, i.e. ELEMENT_DECLARATION. Note that XSTypeDefinition.SIMPLE_TYPE and XSTypeDefinition.COMPLEX_TYPE can also be used as the objectType 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 empty XSNamedMap if no such definitions exist.

getDocumentLocations

public StringList getDocumentLocations()
[document location]

Returns: a list of document information item

See Also: [document location]

getElementDeclaration

public XSElementDeclaration getElementDeclaration(String name)
Convenience method. Returns a top-level element declaration.

Parameters: name The name of the declaration.

Returns: A top-level element declaration or null if such declaration does not exist.

getGlobalAttributeDecl

public final XSAttributeDecl getGlobalAttributeDecl(String declName)
get one global attribute

getGlobalAttributeGroupDecl

public final XSAttributeGroupDecl getGlobalAttributeGroupDecl(String declName)
get one global attribute group

getGlobalElementDecl

public final XSElementDecl getGlobalElementDecl(String declName)
get one global element

getGlobalGroupDecl

public final XSGroupDecl getGlobalGroupDecl(String declName)
get one global group

getGlobalNotationDecl

public final XSNotationDecl getGlobalNotationDecl(String declName)
get one global notation

getGlobalTypeDecl

public final XSTypeDefinition getGlobalTypeDecl(String declName)
get one global type

getGrammarDescription

public XMLGrammarDescription getGrammarDescription()

getIDConstraintDecl

public final IdentityConstraint getIDConstraintDecl(String declName)
get one identity constraint

getImportedGrammars

public Vector getImportedGrammars()

getModelGroupDefinition

public XSModelGroupDefinition getModelGroupDefinition(String name)
Convenience method. Returns a top-level model group definition.

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.

Parameters: name The name of the declaration.

Returns: A top-level notation declaration or null if such declaration does not exist.

getSchemaNamespace

public String getSchemaNamespace()
[schema namespace]

Returns: The target namespace of this item.

See Also: [schema namespace]

getTargetNamespace

public final String getTargetNamespace()
Returns this grammar's target namespace.

getTypeDefinition

public XSTypeDefinition getTypeDefinition(String name)
Convenience method. Returns a top-level simple or complex type definition.

Parameters: name The name of the definition.

Returns: An XSTypeDefinition or null if such definition does not exist.

hasIDConstraints

public final boolean hasIDConstraints()
get one identity constraint

isNamespaceAware

public boolean isNamespaceAware()

setImportedGrammars

public void setImportedGrammars(Vector importedGrammars)

toXSModel

public XSModel toXSModel()
Return an XSModel that represents components in this schema grammar.

Returns: an XSModel representing this schema grammar

toXSModel

public XSModel toXSModel(XSGrammar[] grammars)
Copyright B) 1999-2005 Apache XML Project. All Rights Reserved.