| java.lang.Object org.apache.xerces.validators.common.Grammar org.apache.xerces.validators.dtd.DTDGrammar
DTDGrammar | public class DTDGrammar extends Grammar implements XMLDTDScanner.EventHandler(Code) | | A DTD grammar. This class is an EventHandler to receive callbacks from
the XMLDTDScanner. When the callbacks are received, the grammar structures
are directly populated from the callback information.
In addition to being a recipient of scanner callbacks, the DTD grammar
class can act as a pass-through filter for the DTD events. This is useful
for parsers that must expose the DTD information to the application. (e.g.
SAX2 DeclHandler callbacks.)
author: Andy Clark version: $Id: DTDGrammar.java,v 1.10 2001/07/20 17:27:38 lmartin Exp $ |
Method Summary | |
public int | addAttDef(QName elementDecl, QName attributeDecl, int attType, boolean attList, int enumeration, int attDefaultType, int attDefaultValue, boolean isExternal) | public int | addContentSpecNode(int nodeType, int nodeValue) | public int | addContentSpecNode(int nodeType, int leftNodeIndex, int rightNodeIndex) | public int | addElementDecl(QName elementDecl) | public int | addElementDecl(QName elementDecl, int contentSpecType, int contentSpec, boolean isExternal) | public int | addExternalEntityDecl(int name, int publicId, int systemId) | public int | addExternalPEDecl(int name, int publicId, int systemId) | public int | addInternalEntityDecl(int name, int value) | public int | addInternalPEDecl(int name, int value) | public void | addNameToEnumeration(int enumIndex, int elementType, int attrName, int nameIndex, boolean isNotationType) | public int | addNotationDecl(int notationName, int publicId, int systemId) | public int | addUniqueLeafNode(int nameIndex) | public int | addUnparsedEntityDecl(int name, int publicId, int systemId, int notationName) | public void | callComment(int data) | public void | callEndDTD() End of DTD. | public void | callProcessingInstruction(int piTarget, int piData) | public void | callStartDTD() Start of DTD. | public void | callTextDecl(int version, int encoding) Signal the Text declaration of an external entity. | public void | doctypeDecl(QName rootElement, int publicId, int systemId) | public void | endEntityDecl() End the scope of an entity declaration. | public void | endEnumeration(int enumIndex) | public boolean | getAttributeDeclIsExternal(int attributeDeclIndex) | public String | getContentSpecNodeAsString(int nodeIndex) | public int | getElementDeclIndex(QName element, int scopeIndex) | public boolean | getElementDeclIsExternal(int elementDeclIndex) | public boolean | getRootElementQName(QName root) | public void | internalSubset(int internalSubset) Supports DOM Level 2 internalSubset additions. | protected boolean | isDTD() | protected void | putElementNameMapping(QName name, int scope, int elementDeclIndex) | public void | reset(StringPool stringPool) Resets the DTD grammar. | public void | setElementDeclDTD(int elementDeclIndex, XMLElementDecl elementDecl) | public void | setElementDeclIsExternal(int elementDeclIndex, boolean isExternal) | public boolean | startEntityDecl(boolean isPE, int entityName) Start the scope of an entity declaration. | public int | startEnumeration() | public void | startReadingFromExternalSubset(int publicId, int systemId) | public void | stopReadingFromExternalSubset() |
addAttDef | public int addAttDef(QName elementDecl, QName attributeDecl, int attType, boolean attList, int enumeration, int attDefaultType, int attDefaultValue, boolean isExternal) throws Exception(Code) | | Add an attribute definition
Parameters: handle - to the element whose attribute is being declared Parameters: attName - StringPool handle to the attribute name being declared Parameters: attType - type of the attribute Parameters: enumeration - StringPool handle of the attribute's enumeration list (if any) Parameters: attDefaultType - an integer value denoting the DefaultDecl value Parameters: attDefaultValue - StringPool handle of this attribute's default value handle to the attribute definition exception: java.lang.Exception - |
addContentSpecNode | public int addContentSpecNode(int nodeType, int nodeValue) throws Exception(Code) | | Create an XMLContentSpec for a single non-leaf
Parameters: nodeType - the type of XMLContentSpec to create - from XMLContentSpec.CONTENTSPECNODE_* Parameters: nodeValue - handle to an XMLContentSpec handle to the newly create XMLContentSpec exception: java.lang.Exception - |
addContentSpecNode | public int addContentSpecNode(int nodeType, int leftNodeIndex, int rightNodeIndex) throws Exception(Code) | | Create an XMLContentSpec for a two child leaf
Parameters: nodeType - the type of XMLContentSpec to create - from XMLContentSpec.CONTENTSPECNODE_* Parameters: leftNodeIndex - handle to an XMLContentSpec Parameters: rightNodeIndex - handle to an XMLContentSpec handle to the newly create XMLContentSpec exception: java.lang.Exception - |
addElementDecl | public int addElementDecl(QName elementDecl) throws Exception(Code) | | Add an element declaration (forward reference)
Parameters: handle - to the name of the element being declared handle to the element whose declaration was added exception: java.lang.Exception - |
addElementDecl | public int addElementDecl(QName elementDecl, int contentSpecType, int contentSpec, boolean isExternal) throws Exception(Code) | | Add an element declaration
Parameters: handle - to the name of the element being declared Parameters: contentSpecType - handle to the type name of the content spec Parameters: ContentSpec - handle to the content spec node for the contentSpecType handle to the element declaration that was added exception: java.lang.Exception - |
addExternalEntityDecl | public int addExternalEntityDecl(int name, int publicId, int systemId) throws Exception(Code) | | Add a declaration for an entity
Parameters: name - StringPool handle of the entity name Parameters: publicId - StringPool handle of the publicId Parameters: systemId - StringPool handle of the systemId handle to the entity declaration exception: java.lang.Exception - |
addExternalPEDecl | public int addExternalPEDecl(int name, int publicId, int systemId) throws Exception(Code) | | Add a declaration for an external parameter entity
Parameters: name - StringPool handle of the parameter entity name Parameters: publicId - StringPool handle of the publicId Parameters: systemId - StringPool handle of the systemId handle to the parameter entity declaration exception: java.lang.Exception - |
addInternalEntityDecl | public int addInternalEntityDecl(int name, int value) throws Exception(Code) | | Add a declaration for an internal entity
Parameters: name - StringPool handle of the entity name Parameters: value - StringPool handle of the entity value handle to the entity declaration exception: java.lang.Exception - |
addInternalPEDecl | public int addInternalPEDecl(int name, int value) throws Exception(Code) | | Add a declaration for an internal parameter entity
Parameters: name - StringPool handle of the parameter entity name Parameters: value - StringPool handle of the parameter entity value handle to the parameter entity declaration exception: java.lang.Exception - |
addNameToEnumeration | public void addNameToEnumeration(int enumIndex, int elementType, int attrName, int nameIndex, boolean isNotationType) throws Exception(Code) | | Add a name to an enumeration
Parameters: enumIndex - StringPool handle to the string list for the enumeration Parameters: elementType - handle to the element that owns the attribute with the enumeration Parameters: attrName - StringPool handle to the name of the attribut with the enumeration Parameters: nameIndex - StringPool handle to the name to be added to the enumeration Parameters: isNotationType - true if the enumeration is an enumeration of NOTATION names exception: java.lang.Exception - |
addNotationDecl | public int addNotationDecl(int notationName, int publicId, int systemId) throws Exception(Code) | | Add a declaration for a notation
Parameters: notationName - Parameters: publicId - Parameters: systemId - handle to the notation declaration exception: java.lang.Exception - |
addUniqueLeafNode | public int addUniqueLeafNode(int nameIndex) throws Exception(Code) | | create an XMLContentSpec for a leaf
Parameters: nameIndex - StringPool handle to the name (Element) for the node handle to the newly create XMLContentSpec exception: java.lang.Exception - |
addUnparsedEntityDecl | public int addUnparsedEntityDecl(int name, int publicId, int systemId, int notationName) throws Exception(Code) | | Add a declaration for an unparsed entity
Parameters: name - StringPool handle of the entity name Parameters: publicId - StringPool handle of the publicId Parameters: systemId - StringPool handle of the systemId Parameters: notationName - StringPool handle of the notationName handle to the entity declaration exception: java.lang.Exception - |
callComment | public void callComment(int data) throws Exception(Code) | | Called when a comment has been scanned
Parameters: data - StringPool handle of the comment text exception: java.lang.Exception - |
callProcessingInstruction | public void callProcessingInstruction(int piTarget, int piData) throws Exception(Code) | | Called when a processing instruction has been scanned
Parameters: piTarget - StringPool handle of the PI target Parameters: piData - StringPool handle of the PI data exception: java.lang.Exception - |
callStartDTD | public void callStartDTD() throws Exception(Code) | | Start of DTD.
|
callTextDecl | public void callTextDecl(int version, int encoding) throws Exception(Code) | | Signal the Text declaration of an external entity.
Parameters: version - the handle in the string pool for the version number Parameters: encoding - the handle in the string pool for the encoding exception: java.lang.Exception - |
doctypeDecl | public void doctypeDecl(QName rootElement, int publicId, int systemId) throws Exception(Code) | | Called when the doctype decl is scanned
Parameters: rootElementType - handle of the rootElement Parameters: publicId - StringPool handle of the public id Parameters: systemId - StringPool handle of the system id exception: java.lang.Exception - |
endEnumeration | public void endEnumeration(int enumIndex) throws Exception(Code) | | Finish processing an enumeration
Parameters: enumIndex - handle to the string list which holds the enumeration to be finshed. exception: java.lang.Exception - |
getAttributeDeclIsExternal | public boolean getAttributeDeclIsExternal(int attributeDeclIndex)(Code) | | |
getContentSpecNodeAsString | public String getContentSpecNodeAsString(int nodeIndex) throws Exception(Code) | | Create a string representation of an XMLContentSpec tree
Parameters: handle - to an XMLContentSpec String representation of the content spec tree exception: java.lang.Exception - |
getElementDeclIndex | public int getElementDeclIndex(QName element, int scopeIndex)(Code) | | public int getElementDeclIndex(int localpartIndex, int scopeIndex) {
//System.out.println("getElementDeclIndex: "+localpartIndex+", "+scopeIndex);
return super.getElementDeclIndex(localpartIndex, scopeIndex);
}
public int getElementDeclIndex(int uriIndex, int localpartIndex, int scopeIndex) {
//System.out.println("!!! getElementDeclIndex: "+uriIndex+", "+localpartIndex+", "+scopeIndex);
return super.getElementDeclIndex(localpartIndex, -1);
}
/**
|
getElementDeclIsExternal | public boolean getElementDeclIsExternal(int elementDeclIndex)(Code) | | |
getRootElementQName | public boolean getRootElementQName(QName root)(Code) | | |
internalSubset | public void internalSubset(int internalSubset) throws Exception(Code) | | Supports DOM Level 2 internalSubset additions.
Called when the internal subset is completely scanned.
|
isDTD | protected boolean isDTD()(Code) | | |
putElementNameMapping | protected void putElementNameMapping(QName name, int scope, int elementDeclIndex)(Code) | | |
setElementDeclDTD | public void setElementDeclDTD(int elementDeclIndex, XMLElementDecl elementDecl)(Code) | | |
setElementDeclIsExternal | public void setElementDeclIsExternal(int elementDeclIndex, boolean isExternal)(Code) | | public void setContentSpecLeaf(int contentSpecIndex, QName elementName) {
fTempContentSpec.setValues(XMLContentSpec.CONTENTSPECNODE_LEAF, elementName.rawname, -1);
super.setContentSpec(contentSpecIndex, fTempContentSpec);
}
/**
|
startEntityDecl | public boolean startEntityDecl(boolean isPE, int entityName) throws Exception(Code) | | Start the scope of an entity declaration.
true on success; otherwisefalse if the entity declaration is recursive. exception: java.lang.Exception - |
startEnumeration | public int startEnumeration() throws Exception(Code) | | Called when the scanner start scanning an enumeration
StringPool handle to a string list that will hold the enumeration names exception: java.lang.Exception - |
startReadingFromExternalSubset | public void startReadingFromExternalSubset(int publicId, int systemId) throws Exception(Code) | | Called when the DTDScanner starts reading from the external subset
Parameters: publicId - StringPool handle of the public id Parameters: systemId - StringPool handle of the system id exception: java.lang.Exception - |
stopReadingFromExternalSubset | public void stopReadingFromExternalSubset() throws Exception(Code) | | Called when the DTDScanner stop reading from the external subset
exception: java.lang.Exception - |
Fields inherited from org.apache.xerces.validators.common.Grammar | final public static int TOP_LEVEL_SCOPE(Code)(Java Doc)
|
Methods inherited from org.apache.xerces.validators.common.Grammar | protected void clearContentModel(int contentSpecIndex)(Code)(Java Doc) protected int convertContentSpecTree(int index)(Code)(Java Doc) protected int createAttributeDecl()(Code)(Java Doc) protected int createContentSpec()(Code)(Java Doc) protected int createElementDecl()(Code)(Java Doc) protected boolean existContentModel(int contentSpecIndex)(Code)(Java Doc) public boolean getAttributeDecl(int attributeDeclIndex, XMLAttributeDecl attributeDecl)(Code)(Java Doc) public XMLContentModel getContentModel(int contentSpecIndex, int contentType, SubstitutionGroupComparator comparator) throws Exception(Code)(Java Doc) public boolean getContentSpec(int contentSpecIndex, XMLContentSpec contentSpec)(Code)(Java Doc) public XMLContentModel getElementContentModel(int elementDeclIndex, SubstitutionGroupComparator comparator) throws Exception(Code)(Java Doc) public boolean getElementDecl(int elementDeclIndex, XMLElementDecl elementDecl)(Code)(Java Doc) public int getElementDeclIndex(int localpartIndex, int scopeIndex)(Code)(Java Doc) public int getElementDeclIndex(int uriIndex, int localpartIndex, int scopeIndex)(Code)(Java Doc) public int getElementDeclIndex(QName element, int scopeIndex)(Code)(Java Doc) public int getFirstAttributeDeclIndex(int elementDeclIndex)(Code)(Java Doc) public Document getGrammarDocument()(Code)(Java Doc) public int getNextAttributeDeclIndex(int attributeDeclIndex)(Code)(Java Doc) protected boolean isDTD()(Code)(Java Doc) public void printAttributes(int elementDeclIndex)(Code)(Java Doc) public void printElements(org.apache.xerces.utils.StringPool pool)(Code)(Java Doc) protected void putElementNameMapping(QName name, int scope, int elementDeclIndex)(Code)(Java Doc) protected void setAttributeDecl(int elementDeclIndex, int attributeDeclIndex, XMLAttributeDecl attributeDecl)(Code)(Java Doc) protected void setContentSpec(int contentSpecIndex, XMLContentSpec contentSpec)(Code)(Java Doc) protected void setElementDecl(int elementDeclIndex, XMLElementDecl elementDecl)(Code)(Java Doc) protected void setFirstAttributeDeclIndex(int elementDeclIndex, int newFirstAttrIndex)(Code)(Java Doc) protected void setGrammarDocument(Document grammarDocument)(Code)(Java Doc)
|
|
|