public class

SchemaGrammar

extends Object
implements XSGrammar XSNamespaceItem
java.lang.Object
   ↳ org.apache.xerces.impl.xs.SchemaGrammar
Known Direct Subclasses

Class Overview

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.

Summary

Nested Classes
class SchemaGrammar.BuiltinSchemaGrammar  
class SchemaGrammar.Schema4Annotations

A partial schema for schemas for validating annotations. 

Fields
public static final SchemaGrammar.Schema4Annotations SG_Schema4Annotations
public static final SchemaGrammar.BuiltinSchemaGrammar SG_SchemaNS
public static final SchemaGrammar.BuiltinSchemaGrammar SG_XSI
public static final XSSimpleType fAnySimpleType
public static final XSComplexTypeDecl fAnyType
Public Constructors
SchemaGrammar(String targetNamespace, XSDDescription grammarDesc, SymbolTable symbolTable)
Default constructor.
Protected Constructors
SchemaGrammar()
Public Methods
void addAnnotation(XSAnnotationImpl annotation)
void addComplexTypeDecl(XSComplexTypeDecl decl, SimpleLocator locator)
add one complex type decl: for later constraint checking
synchronized void addDocument(Object document, String location)
void addGlobalAttributeDecl(XSAttributeDecl decl)
register one global attribute
void addGlobalAttributeGroupDecl(XSAttributeGroupDecl decl)
register one global attribute group
void addGlobalElementDecl(XSElementDecl decl)
register one global element
void addGlobalGroupDecl(XSGroupDecl decl)
register one global group
void addGlobalNotationDecl(XSNotationDecl decl)
register one global notation
void addGlobalTypeDecl(XSTypeDefinition decl)
register one global type
final void addIDConstraintDecl(XSElementDecl elmDecl, IdentityConstraint decl)
register one identity constraint
void addRedefinedGroupDecl(XSGroupDecl derived, XSGroupDecl base, SimpleLocator locator)
add a group redefined by restriction: for later constraint checking
XSObjectList getAnnotations()
[annotations]: a set of annotations if it exists, otherwise an empty XSObjectList.
XSAttributeDeclaration getAttributeDeclaration(String name)
Convenience method.
XSAttributeGroupDefinition getAttributeGroup(String name)
Convenience method.
synchronized XSNamedMap getComponents(short objectType)
[schema components]: a list of top-level components, i.e.
StringList getDocumentLocations()
[document location]
XSElementDeclaration getElementDeclaration(String name)
Convenience method.
final XSAttributeDecl getGlobalAttributeDecl(String declName)
get one global attribute
final XSAttributeGroupDecl getGlobalAttributeGroupDecl(String declName)
get one global attribute group
final XSElementDecl getGlobalElementDecl(String declName)
get one global element
final XSGroupDecl getGlobalGroupDecl(String declName)
get one global group
final XSNotationDecl getGlobalNotationDecl(String declName)
get one global notation
final XSTypeDefinition getGlobalTypeDecl(String declName)
get one global type
XMLGrammarDescription getGrammarDescription()
get the XMLGrammarDescription associated with this object
final IdentityConstraint getIDConstraintDecl(String declName)
get one identity constraint
Vector getImportedGrammars()
XSModelGroupDefinition getModelGroupDefinition(String name)
Convenience method.
XSNotationDeclaration getNotationDeclaration(String name)
Convenience method.
String getSchemaNamespace()
[schema namespace]
final String getTargetNamespace()
Returns this grammar's target namespace.
XSTypeDefinition getTypeDefinition(String name)
Convenience method.
final boolean hasIDConstraints()
get one identity constraint
boolean isNamespaceAware()
void setImportedGrammars(Vector importedGrammars)
XSModel toXSModel()
Return an XSModel that represents components in this schema grammar.
XSModel toXSModel(XSGrammar[] grammars)
Return an XSModel that represents components in this schema grammar and the grammars in the grammarsparameter, any schema grammars that are imported by them directly or indirectly.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.apache.xerces.xni.grammars.Grammar
From interface org.apache.xerces.xni.grammars.XSGrammar
From interface org.apache.xerces.xs.XSNamespaceItem

Fields

public static final SchemaGrammar.Schema4Annotations SG_Schema4Annotations

public static final SchemaGrammar.BuiltinSchemaGrammar SG_SchemaNS

public static final SchemaGrammar.BuiltinSchemaGrammar SG_XSI

public static final XSSimpleType fAnySimpleType

public static final XSComplexTypeDecl fAnyType

Public Constructors

public SchemaGrammar (String targetNamespace, XSDDescription grammarDesc, SymbolTable symbolTable)

Default constructor.

Parameters
grammarDesc the XMLGrammarDescription corresponding to this objec at the least a systemId should always be known.
symbolTable needed for annotation support

Protected Constructors

protected SchemaGrammar ()

Public Methods

public void addAnnotation (XSAnnotationImpl annotation)

public void addComplexTypeDecl (XSComplexTypeDecl decl, SimpleLocator locator)

add one complex type decl: for later constraint checking

public synchronized void addDocument (Object document, String location)

public void addGlobalAttributeDecl (XSAttributeDecl decl)

register one global attribute

public void addGlobalAttributeGroupDecl (XSAttributeGroupDecl decl)

register one global attribute group

public void addGlobalElementDecl (XSElementDecl decl)

register one global element

public void addGlobalGroupDecl (XSGroupDecl decl)

register one global group

public void addGlobalNotationDecl (XSNotationDecl decl)

register one global notation

public void addGlobalTypeDecl (XSTypeDefinition decl)

register one global type

public final void addIDConstraintDecl (XSElementDecl elmDecl, IdentityConstraint decl)

register one identity constraint

public void addRedefinedGroupDecl (XSGroupDecl derived, XSGroupDecl base, SimpleLocator locator)

add a group redefined by restriction: for later constraint checking

public XSObjectList getAnnotations ()

[annotations]: a set of annotations if it exists, otherwise an empty XSObjectList.

See Also

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.

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.

public synchronized 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.

public StringList getDocumentLocations ()

[document location]

Returns
  • a list of document information item

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.

public final XSAttributeDecl getGlobalAttributeDecl (String declName)

get one global attribute

public final XSAttributeGroupDecl getGlobalAttributeGroupDecl (String declName)

get one global attribute group

public final XSElementDecl getGlobalElementDecl (String declName)

get one global element

public final XSGroupDecl getGlobalGroupDecl (String declName)

get one global group

public final XSNotationDecl getGlobalNotationDecl (String declName)

get one global notation

public final XSTypeDefinition getGlobalTypeDecl (String declName)

get one global type

public XMLGrammarDescription getGrammarDescription ()

get the XMLGrammarDescription associated with this object

public final IdentityConstraint getIDConstraintDecl (String declName)

get one identity constraint

public Vector getImportedGrammars ()

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.

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.

public String getSchemaNamespace ()

[schema namespace]

Returns
  • The target namespace of this item.

public final String getTargetNamespace ()

Returns this grammar's target namespace.

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.

public final boolean hasIDConstraints ()

get one identity constraint

public boolean isNamespaceAware ()

public void setImportedGrammars (Vector importedGrammars)

public XSModel toXSModel ()

Return an XSModel that represents components in this schema grammar.

Returns
  • an XSModel representing this schema grammar

public XSModel toXSModel (XSGrammar[] grammars)

Return an XSModel that represents components in this schema grammar and the grammars in the grammarsparameter, any schema grammars that are imported by them directly or indirectly.

Returns
  • an XSModel representing these schema grammars