Save This Page
Home » Xerces-J-src.2.9.1 » org.apache.xerces » impl » dtd » [javadoc | source]
org.apache.xerces.impl.dtd
public class: DTDGrammar [javadoc | source]
java.lang.Object
   org.apache.xerces.impl.dtd.DTDGrammar

All Implemented Interfaces:
    EntityState, XMLDTDContentModelHandler, XMLDTDHandler, Grammar

Direct Known Subclasses:
    BalancedDTDGrammar

A DTD grammar. This class implements the XNI handler interfaces for DTD information so that it can build the approprate validation structures automatically from the callbacks.
Nested Class Summary:
protected static final class  DTDGrammar.QNameHashtable  A simple Hashtable implementation that takes a tuple (String, String) as the key and a int as value. 
Field Summary
public static final  int TOP_LEVEL_SCOPE    Top level scope (-1). 
protected  XMLDTDSource fDTDSource     
protected  XMLDTDContentModelSource fDTDContentModelSource     
protected  int fCurrentElementIndex    Current element index. 
protected  int fCurrentAttributeIndex    Current attribute index. 
protected  boolean fReadingExternalDTD    fReadingExternalDTD 
protected  XMLDTDDescription fGrammarDescription     
protected final  XMLAttributeDecl fAttributeDecl    Temporary Attribute decl. 
 Hashtable fElementDeclTab    table of XMLElementDecl 
 int valueIndex     
 int prevNodeIndex     
 int nodeIndex     
Constructor:
 public DTDGrammar(SymbolTable symbolTable,
    XMLDTDDescription desc) 
    Default constructor.
Method from org.apache.xerces.impl.dtd.DTDGrammar Summary:
addContentSpecNode,   addContentSpecNode,   addContentSpecToElement,   addUniqueLeafNode,   any,   attributeDecl,   comment,   createAttributeDecl,   createContentSpec,   createElementDecl,   createEntityDecl,   createNotationDecl,   element,   elementDecl,   empty,   endAttlist,   endConditional,   endContentModel,   endDTD,   endExternalSubset,   endGroup,   endParameterEntity,   externalEntityDecl,   getAttributeDecl,   getAttributeDeclIndex,   getAttributeDeclIsExternal,   getContentSpec,   getContentSpecAsString,   getContentSpecIndex,   getContentSpecType,   getDTDContentModelSource,   getDTDSource,   getElementContentModelValidator,   getElementDecl,   getElementDeclIndex,   getElementDeclIndex,   getElementDeclIsExternal,   getElementDeclName,   getEntityDecl,   getEntityDeclIndex,   getFirstAttributeDeclIndex,   getFirstElementDeclIndex,   getGrammarDescription,   getNextAttributeDeclIndex,   getNextElementDeclIndex,   getNotationDecl,   getNotationDeclIndex,   getSymbolTable,   ignoredCharacters,   initializeContentModelStack,   internalEntityDecl,   isCDATAAttribute,   isEntityDeclared,   isEntityUnparsed,   isImmutable,   isNamespaceAware,   notationDecl,   occurrence,   pcdata,   printAttributes,   printElements,   processingInstruction,   putElementNameMapping,   separator,   setAttributeDecl,   setContentSpec,   setContentSpecIndex,   setDTDContentModelSource,   setDTDSource,   setElementDecl,   setEntityDecl,   setFirstAttributeDeclIndex,   setNotationDecl,   startAttlist,   startConditional,   startContentModel,   startDTD,   startExternalSubset,   startGroup,   startParameterEntity,   textDecl,   unparsedEntityDecl
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.xerces.impl.dtd.DTDGrammar Detail:
 protected int addContentSpecNode(short nodeType,
    String nodeValue) 
    Create an XMLContentSpec for a single non-leaf
 protected int addContentSpecNode(short nodeType,
    int leftNodeIndex,
    int rightNodeIndex) 
    Create an XMLContentSpec for a two child leaf
 protected  void addContentSpecToElement(XMLElementDecl elementDecl) 
    Adds the content spec to the given element declaration.
 protected int addUniqueLeafNode(String elementName) 
    create an XMLContentSpec for a leaf
 public  void any(Augmentations augs) throws XNIException 
    A content model of ANY.
 public  void attributeDecl(String elementName,
    String attributeName,
    String type,
    String[] enumeration,
    String defaultType,
    XMLString defaultValue,
    XMLString nonNormalizedDefaultValue,
    Augmentations augs) throws XNIException 
    An attribute declaration.
 public  void comment(XMLString text,
    Augmentations augs) throws XNIException 
    A comment.
 protected int createAttributeDecl() 
 protected int createContentSpec() 
 protected int createElementDecl() 
 protected int createEntityDecl() 
 protected int createNotationDecl() 
 public  void element(String elementName,
    Augmentations augs) throws XNIException 
    A referenced element in a mixed or children content model.
 public  void elementDecl(String name,
    String contentModel,
    Augmentations augs) throws XNIException 
    An element declaration.
 public  void empty(Augmentations augs) throws XNIException 
    A content model of EMPTY.
 public  void endAttlist(Augmentations augs) throws XNIException 
    The end of an attribute list.
 public  void endConditional(Augmentations augs) throws XNIException 
    The end of a conditional section.
 public  void endContentModel(Augmentations augs) throws XNIException 
    The end of a content model.
 public  void endDTD(Augmentations augs) throws XNIException 
    The end of the DTD.
 public  void endExternalSubset(Augmentations augs) throws XNIException 
    The end of the DTD external subset.
 public  void endGroup(Augmentations augs) throws XNIException 
    The end of a group for mixed or children content models.
 public  void endParameterEntity(String name,
    Augmentations augs) throws XNIException 
    This method notifies the end of an entity. The DTD has the pseudo-name of "[dtd]" and parameter entity names start with '%'.

    Note: Since the DTD is an entity, the handler will be notified of the end of the DTD entity by calling the endEntity method with the entity name "[dtd]" after calling the endDTD method.

 public  void externalEntityDecl(String name,
    XMLResourceIdentifier identifier,
    Augmentations augs) throws XNIException 
    An external entity declaration.
 public boolean getAttributeDecl(int attributeDeclIndex,
    XMLAttributeDecl attributeDecl) 
    getAttributeDecl
 public int getAttributeDeclIndex(int elementDeclIndex,
    String attributeDeclName) 
 public boolean getAttributeDeclIsExternal(int attributeDeclIndex) 
    Returns true if the specified attribute declaration is external.
 public boolean getContentSpec(int contentSpecIndex,
    XMLContentSpec contentSpec) 
    getContentSpec
 public String getContentSpecAsString(int elementDeclIndex) 
    getContentSpecAsString
 public int getContentSpecIndex(int elementDeclIndex) 
    Returns the index to the content spec for the given element declaration, or -1 if the element declaration index was invalid.
 public short getContentSpecType(int elementIndex) 
    make separate function for getting contentSpecType of element. we can avoid setting of the element values.
 public XMLDTDContentModelSource getDTDContentModelSource() 
 public XMLDTDSource getDTDSource() 
 protected ContentModelValidator getElementContentModelValidator(int elementDeclIndex) 
    getElementContentModelValidator
 public boolean getElementDecl(int elementDeclIndex,
    XMLElementDecl elementDecl) 
    getElementDecl
 public int getElementDeclIndex(String elementDeclName) 
    getElementDeclIndex
 public int getElementDeclIndex(QName elementDeclQName) 
    Returns the element decl index.
 public boolean getElementDeclIsExternal(int elementDeclIndex) 
    Returns true if the specified element declaration is external.
 QName getElementDeclName(int elementDeclIndex) 
 public boolean getEntityDecl(int entityDeclIndex,
    XMLEntityDecl entityDecl) 
    getEntityDecl
 public int getEntityDeclIndex(String entityDeclName) 
    getEntityDeclIndex
 public int getFirstAttributeDeclIndex(int elementDeclIndex) 
    getFirstAttributeDeclIndex
 public int getFirstElementDeclIndex() 
    Returns the index of the first element declaration. This index is then used to query more information about the element declaration.
 public XMLGrammarDescription getGrammarDescription() 
 public int getNextAttributeDeclIndex(int attributeDeclIndex) 
    getNextAttributeDeclIndex
 public int getNextElementDeclIndex(int elementDeclIndex) 
    Returns the next index of the element declaration following the specified element declaration.
 public boolean getNotationDecl(int notationDeclIndex,
    XMLNotationDecl notationDecl) 
    getNotationDecl
 public int getNotationDeclIndex(String notationDeclName) 
    getNotationDeclIndex
 public SymbolTable getSymbolTable() 
    Returns the symbol table.
 public  void ignoredCharacters(XMLString text,
    Augmentations augs) throws XNIException 
    Characters within an IGNORE conditional section.
 protected  void initializeContentModelStack() 
    Initialize content model stack.
 public  void internalEntityDecl(String name,
    XMLString text,
    XMLString nonNormalizedText,
    Augmentations augs) throws XNIException 
    An internal entity declaration.
 public boolean isCDATAAttribute(QName elName,
    QName atName) 
    Returns whether the given attribute is of type CDATA or not
 public boolean isEntityDeclared(String name) 
 public boolean isEntityUnparsed(String name) 
 boolean isImmutable() 
 public boolean isNamespaceAware() 
    Returns true if this grammar is namespace aware.
 public  void notationDecl(String name,
    XMLResourceIdentifier identifier,
    Augmentations augs) throws XNIException 
    A notation declaration
 public  void occurrence(short occurrence,
    Augmentations augs) throws XNIException 
    The occurrence count for a child in a children content model or for the mixed content model group.
 public  void pcdata(Augmentations augs) throws XNIException 
    The appearance of "#PCDATA" within a group signifying a mixed content model. This method will be the first called following the content model's startGroup().
 public  void printAttributes(int elementDeclIndex) 
 public  void printElements() 
 public  void processingInstruction(String target,
    XMLString data,
    Augmentations augs) throws XNIException 
    A processing instruction. Processing instructions consist of a target name and, optionally, text data. The data is only meaningful to the application.

    Typically, a processing instruction's data will contain a series of pseudo-attributes. These pseudo-attributes follow the form of element attributes but are not parsed or presented to the application as anything other than text. The application is responsible for parsing the data.

 protected  void putElementNameMapping(QName name,
    int scope,
    int elementDeclIndex) 
 public  void separator(short separator,
    Augmentations augs) throws XNIException 
    The separator between choices or sequences of a mixed or children content model.
 protected  void setAttributeDecl(int elementDeclIndex,
    int attributeDeclIndex,
    XMLAttributeDecl attributeDecl) 
 protected  void setContentSpec(int contentSpecIndex,
    XMLContentSpec contentSpec) 
 protected  void setContentSpecIndex(int elementDeclIndex,
    int contentSpecIndex) 
 public  void setDTDContentModelSource(XMLDTDContentModelSource source) 
 public  void setDTDSource(XMLDTDSource source) 
 protected  void setElementDecl(int elementDeclIndex,
    XMLElementDecl elementDecl) 
 protected  void setEntityDecl(int entityDeclIndex,
    XMLEntityDecl entityDecl) 
 protected  void setFirstAttributeDeclIndex(int elementDeclIndex,
    int newFirstAttrIndex) 
 protected  void setNotationDecl(int notationDeclIndex,
    XMLNotationDecl notationDecl) 
 public  void startAttlist(String elementName,
    Augmentations augs) throws XNIException 
    The start of an attribute list.
 public  void startConditional(short type,
    Augmentations augs) throws XNIException 
    The start of a conditional section.
 public  void startContentModel(String elementName,
    Augmentations augs) throws XNIException 
    The start of a content model. Depending on the type of the content model, specific methods may be called between the call to the startContentModel method and the call to the endContentModel method.
 public  void startDTD(XMLLocator locator,
    Augmentations augs) throws XNIException 
    The start of the DTD.
 public  void startExternalSubset(XMLResourceIdentifier identifier,
    Augmentations augs) throws XNIException 
    The start of the DTD external subset.
 public  void startGroup(Augmentations augs) throws XNIException 
    A start of either a mixed or children content model. A mixed content model will immediately be followed by a call to the pcdata() method. A children content model will contain additional groups and/or elements.
 public  void startParameterEntity(String name,
    XMLResourceIdentifier identifier,
    String encoding,
    Augmentations augs) throws XNIException 
    This method notifies of the start of an entity. The DTD has the pseudo-name of "[dtd]" and parameter entity names start with '%'.

    Note: Since the DTD is an entity, the handler will be notified of the start of the DTD entity by calling the startParameterEntity method with the entity name "[dtd]" before calling the startDTD method.

 public  void textDecl(String version,
    String encoding,
    Augmentations augs) throws XNIException 
    Notifies of the presence of a TextDecl line in an entity. If present, this method will be called immediately following the startEntity call.

    Note: This method is only called for external parameter entities referenced in the DTD.

 public  void unparsedEntityDecl(String name,
    XMLResourceIdentifier identifier,
    String notation,
    Augmentations augs) throws XNIException 
    An unparsed entity declaration.