## org.apache.xerces.validators.common
Class Grammar

    java.lang.Object
      |
      +--org.apache.xerces.validators.common.Grammar

Direct Known Subclasses:
  DTDGrammar, SchemaGrammar

public class Grammar
extends java.lang.Object
implements XMLContentSpec.Provider

Version:
  $Id: Grammar.java,v 1.30 2001/08/10 13:18:09 sandygao Exp $

Field Summary
`static int` `TOP_LEVEL_SCOPE` Signifies top level scope (-1).

Constructor Summary
`Grammar()`

Method Summary
`protected void` `clearContentModel(int contentSpecIndex)`
`protected int` `convertContentSpecTree(int index)`
`protected int` `createAttributeDecl()`
`protected int` `createContentSpec()`
`protected int` `createElementDecl()`
`protected boolean` `existContentModel(int contentSpecIndex)`
`boolean` `getAttributeDecl(int attributeDeclIndex, XMLAttributeDecl attributeDecl)`
`XMLContentModel` `getContentModel(int contentSpecIndex, int contentType, SubstitutionGroupComparator comparator)`
`boolean` `getContentSpec(int contentSpecIndex, XMLContentSpec contentSpec)` Fills in the provided content spec structure with content spec information for a unique identifier.
`XMLContentModel` `getElementContentModel(int elementDeclIndex, SubstitutionGroupComparator comparator)`
`boolean` `getElementDecl(int elementDeclIndex, XMLElementDecl elementDecl)`
`int` `getElementDeclIndex(int localpartIndex, int scopeIndex)`
`int` `getElementDeclIndex(int uriIndex, int localpartIndex, int scopeIndex)`
`int` `getElementDeclIndex(QName element, int scopeIndex)`
`int` `getFirstAttributeDeclIndex(int elementDeclIndex)`
`Document` `getGrammarDocument()`
`int` `getNextAttributeDeclIndex(int attributeDeclIndex)`
`protected boolean` `isDTD()`
`void` `printAttributes(int elementDeclIndex)`
`void` `printElements(StringPool pool)`
`protected void` `putElementNameMapping(QName name, int scope, int elementDeclIndex)`
`protected void` `setAttributeDecl(int elementDeclIndex, int attributeDeclIndex, XMLAttributeDecl attributeDecl)`
`protected void` `setContentSpec(int contentSpecIndex, XMLContentSpec contentSpec)`
`protected void` `setElementDecl(int elementDeclIndex, XMLElementDecl elementDecl)`
`protected void` `setFirstAttributeDeclIndex(int elementDeclIndex, int newFirstAttrIndex)`
`protected void` `setGrammarDocument(Document grammarDocument)`

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

Field Detail

### TOP_LEVEL_SCOPE

    public static final int TOP_LEVEL_SCOPE

  Signifies top level scope (-1).

Constructor Detail

### Grammar

    public Grammar()

Method Detail

### getGrammarDocument

    public Document getGrammarDocument()

### getElementDeclIndex

    public int getElementDeclIndex(int localpartIndex,
                                   int scopeIndex)

### getElementDeclIndex

    public int getElementDeclIndex(int uriIndex,
                                   int localpartIndex,
                                   int scopeIndex)

### getElementDeclIndex

    public int getElementDeclIndex(QName element,
                                   int scopeIndex)

### getElementDecl

    public boolean getElementDecl(int elementDeclIndex,
                                  XMLElementDecl elementDecl)

### getFirstAttributeDeclIndex

    public int getFirstAttributeDeclIndex(int elementDeclIndex)

### getNextAttributeDeclIndex

    public int getNextAttributeDeclIndex(int attributeDeclIndex)

### getContentSpec

    public boolean getContentSpec(int contentSpecIndex,
                                  XMLContentSpec contentSpec)

  Description copied from interface: XMLContentSpec.Provider
  Fills in the provided content spec structure with content spec information for a unique identifier.
  Specified by:
    getContentSpec in interface XMLContentSpec.Provider
  Tags copied from interface: XMLContentSpec.Provider
  Parameters:
    `contentSpecIndex` - The content spec identifier. All content spec "nodes" have a unique identifier.
    `contentSpec` - The content spec struct to fill in with the information.
  Returns:
    Returns true if the contentSpecIndex was found.

### clearContentModel

    protected void clearContentModel(int contentSpecIndex)

### existContentModel

    protected boolean existContentModel(int contentSpecIndex)

### getElementContentModel

    public XMLContentModel getElementContentModel(int elementDeclIndex,
                                                  SubstitutionGroupComparator comparator)
                                           throws java.lang.Exception

### getContentModel

    public XMLContentModel getContentModel(int contentSpecIndex,
                                           int contentType,
                                           SubstitutionGroupComparator comparator)
                                    throws java.lang.Exception

### getAttributeDecl

    public boolean getAttributeDecl(int attributeDeclIndex,
                                    XMLAttributeDecl attributeDecl)

### setGrammarDocument

    protected void setGrammarDocument(Document grammarDocument)

### convertContentSpecTree

    protected int convertContentSpecTree(int index)

### createElementDecl

    protected int createElementDecl()

### setElementDecl

    protected void setElementDecl(int elementDeclIndex,
                                  XMLElementDecl elementDecl)

### putElementNameMapping

    protected void putElementNameMapping(QName name,
                                         int scope,
                                         int elementDeclIndex)

### setFirstAttributeDeclIndex

    protected void setFirstAttributeDeclIndex(int elementDeclIndex,
                                              int newFirstAttrIndex)

### createContentSpec

    protected int createContentSpec()

### setContentSpec

    protected void setContentSpec(int contentSpecIndex,
                                  XMLContentSpec contentSpec)

### createAttributeDecl

    protected int createAttributeDecl()

### setAttributeDecl

    protected void setAttributeDecl(int elementDeclIndex,
                                    int attributeDeclIndex,
                                    XMLAttributeDecl attributeDecl)

### isDTD

    protected boolean isDTD()

### printElements

    public void printElements(StringPool pool)

### printAttributes

    public void printAttributes(int elementDeclIndex)

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