Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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, XSNamespaceItem

Direct Known Subclasses:
  SchemaGrammar.BuiltinSchemaGrammar

public class SchemaGrammar
extends java.lang.Object
implements org.apache.xerces.xni.grammars.Grammar, org.apache.xerces.xni.grammars.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: SchemaGrammar.java,v 1.28 2003/01/16 23:59:03 sandygao Exp $
Author:
  Sandy Gao, IBM, Elena Litani, IBM

Inner Class Summary
`static class` | `SchemaGrammar.BuiltinSchemaGrammar`

Field Summary
`static XSSimpleType` | `fAnySimpleType`
`static XSComplexTypeDecl` | `fAnyType`
`static SchemaGrammar.BuiltinSchemaGrammar` | `SG_SchemaNS`
`static SchemaGrammar.BuiltinSchemaGrammar` | `SG_XSI`

Constructor Summary
`SchemaGrammar(java.lang.String targetNamespace, XSDDescription grammarDesc)` Default constructor.

Method Summary
`void` | `addComplexTypeDecl(XSComplexTypeDecl decl, SimpleLocator locator)` add one complex type decl: for later constraint checking
`void` | `addDocument(java.lang.Object document, java.lang.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
`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.
`XSAttributeDeclaration` | `getAttributeDeclaration(java.lang.String name)` Convenience method.
`XSAttributeGroupDefinition` | `getAttributeGroup(java.lang.String name)` Convenience method.
`XSNamedMap` | `getComponents(short objectType)` Returns a list of top-level components, i.e.
`StringList` | `getDocumentLocations()` [document location]
`XSElementDeclaration` | `getElementDeclaration(java.lang.String name)` Convenience method.
`XSAttributeDecl` | `getGlobalAttributeDecl(java.lang.String declName)` get one global attribute
`XSAttributeGroupDecl` | `getGlobalAttributeGroupDecl(java.lang.String declName)` get one global attribute group
`XSElementDecl` | `getGlobalElementDecl(java.lang.String declName)` get one global element
`XSGroupDecl` | `getGlobalGroupDecl(java.lang.String declName)` get one global group
`XSNotationDecl` | `getGlobalNotationDecl(java.lang.String declName)` get one global notation
`XSTypeDefinition` | `getGlobalTypeDecl(java.lang.String declName)` get one global type
`org.apache.xerces.xni.grammars.XMLGrammarDescription` | `getGrammarDescription()`
`IdentityConstraint` | `getIDConstraintDecl(java.lang.String declName)` get one identity constraint
`java.util.Vector` | `getImportedGrammars()`
`XSModelGroupDefinition` | `getModelGroupDefinition(java.lang.String name)` Convenience method.
`XSNotationDeclaration` | `getNotationDeclaration(java.lang.String name)` Convenience method.
`java.lang.String` | `getSchemaNamespace()` [schema namespace]
`java.lang.String` | `getTargetNamespace()` Returns this grammar's target namespace.
`XSTypeDefinition` | `getTypeDefinition(java.lang.String name)` Convenience method.
`boolean` | `isNamespaceAware()`
`void` | `setImportedGrammars(java.util.Vector importedGrammars)`
`XSModel` | `toXSModel()` Return an `XSModel` that represents components in this schema grammar.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

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

    public SchemaGrammar(java.lang.String targetNamespace,
                         XSDDescription grammarDesc)

  Default constructor.
  Parameters:
    `targetNamespace` -
    `grammarDesc` - the XMLGrammarDescription corresponding to this objec at the least a systemId should always be known.

Method Detail

### getGrammarDescription

    public org.apache.xerces.xni.grammars.XMLGrammarDescription getGrammarDescription()

  Specified by:
    `getGrammarDescription` in interface `org.apache.xerces.xni.grammars.Grammar`

### isNamespaceAware

    public boolean isNamespaceAware()

### setImportedGrammars

    public void setImportedGrammars(java.util.Vector importedGrammars)

### getImportedGrammars

    public java.util.Vector getImportedGrammars()

### getTargetNamespace

    public final java.lang.String getTargetNamespace()

  Returns this grammar's target namespace.

### 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

### getGlobalAttributeDecl

    public final XSAttributeDecl getGlobalAttributeDecl(java.lang.String declName)

  get one global attribute

### getGlobalAttributeGroupDecl

    public final XSAttributeGroupDecl getGlobalAttributeGroupDecl(java.lang.String declName)

  get one global attribute group

### getGlobalElementDecl

    public final XSElementDecl getGlobalElementDecl(java.lang.String declName)

  get one global element

### getGlobalGroupDecl

    public final XSGroupDecl getGlobalGroupDecl(java.lang.String declName)

  get one global group

### getGlobalNotationDecl

    public final XSNotationDecl getGlobalNotationDecl(java.lang.String declName)

  get one global notation

### getGlobalTypeDecl

    public final XSTypeDefinition getGlobalTypeDecl(java.lang.String declName)

  get one global type

### getIDConstraintDecl

    public final IdentityConstraint getIDConstraintDecl(java.lang.String declName)

  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

### addDocument

    public void addDocument(java.lang.Object document,
                            java.lang.String location)

### getSchemaNamespace

    public java.lang.String getSchemaNamespace()

  [schema namespace]
  Specified by:
    `getSchemaNamespace` in interface `XSNamespaceItem`
  Returns:
    The target namespace of this item.
  See Also:
    [schema namespace]

### getComponents

    public XSNamedMap getComponents(short objectType)

  Returns a list of top-level components, i.e. element declarations, attribute declarations, etc.

  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.

  Specified by:
    `getComponents` in interface `XSNamespaceItem`
  Parameters:
    `objectType` - The type of the declaration, i.e. ELEMENT_DECLARATION, ATTRIBUTE_DECLARATION, etc.
  Returns:
    A list of top-level definition of the specified type in `objectType` or `null`.

### getTypeDefinition

    public XSTypeDefinition getTypeDefinition(java.lang.String name)

  Convenience method. Returns a top-level simple or complex type definition.
  Specified by:
    `getTypeDefinition` in interface `XSNamespaceItem`
  Parameters:
    `name` - The name of the definition.
  Returns:
    An `XSTypeDefinition` or null if such definition does not exist.

### getAttributeDeclaration

    public XSAttributeDeclaration getAttributeDeclaration(java.lang.String name)

  Convenience method. Returns a top-level attribute declaration.
  Specified by:
    `getAttributeDeclaration` in interface `XSNamespaceItem`
  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(java.lang.String name)

  Convenience method. Returns a top-level element declaration.
  Specified by:
    `getElementDeclaration` in interface `XSNamespaceItem`
  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(java.lang.String name)

  Convenience method. Returns a top-level attribute group definition.
  Specified by:
    `getAttributeGroup` in interface `XSNamespaceItem`
  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(java.lang.String name)

  Convenience method. Returns a top-level model group definition.
  Specified by:
    `getModelGroupDefinition` in interface `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

    public XSNotationDeclaration getNotationDeclaration(java.lang.String name)

  Convenience method. Returns a top-level notation declaration.
  Specified by:
    `getNotationDeclaration` in interface `XSNamespaceItem`
  Parameters:
    `name` - The name of the declaration.
  Returns:
    A top-level notation declaration or null if such declaration does not exist.

### getDocumentLocations

    public StringList getDocumentLocations()

  [document location]
  Specified by:
    `getDocumentLocations` in interface `XSNamespaceItem`
  Returns:
    a list of document information item
  See Also:
    [document location]

### toXSModel

    public XSModel toXSModel()

  Return an `XSModel` that represents components in this schema grammar.
  Specified by:
    `toXSModel` in interface `org.apache.xerces.xni.grammars.XSGrammar`
  Returns:
    an `XSModel` representing this schema grammar

### getAnnotations

    public XSObjectList getAnnotations()

  Description copied from interface: `XSNamespaceItem`
  [annotations]: a set of annotations.
  Specified by:
    `getAnnotations` in interface `XSNamespaceItem`
  See Also:
    `XSNamespaceItem.getAnnotations()`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 1999-2003 Apache XML Project. All Rights Reserved.