|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.xerces.validators.common.Grammar | +--org.apache.xerces.validators.dtd.DTDGrammar
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.)
Fields inherited from class org.apache.xerces.validators.common.Grammar |
---|
TOP_LEVEL_SCOPE |
Constructor Summary | |
---|---|
DTDGrammar(StringPool stringPool)
Default constructor. |
Method Summary | |
---|---|
int |
addAttDef(QName elementDecl,
QName attributeDecl,
int attType,
boolean attList,
int enumeration,
int attDefaultType,
int attDefaultValue,
boolean isExternal)
Add an attribute definition |
int |
addContentSpecNode(int nodeType,
int nodeValue)
Create an XMLContentSpec for a single non-leaf |
int |
addContentSpecNode(int nodeType,
int leftNodeIndex,
int rightNodeIndex)
Create an XMLContentSpec for a two child leaf |
int |
addElementDecl(QName elementDecl)
Add an element declaration (forward reference) |
int |
addElementDecl(QName elementDecl,
int contentSpecType,
int contentSpec,
boolean isExternal)
Add an element declaration |
int |
addExternalEntityDecl(int name,
int publicId,
int systemId)
Add a declaration for an entity |
int |
addExternalPEDecl(int name,
int publicId,
int systemId)
Add a declaration for an external parameter entity |
int |
addInternalEntityDecl(int name,
int value)
Add a declaration for an internal entity |
int |
addInternalPEDecl(int name,
int value)
Add a declaration for an internal parameter entity |
void |
addNameToEnumeration(int enumIndex,
int elementType,
int attrName,
int nameIndex,
boolean isNotationType)
Add a name to an enumeration |
int |
addNotationDecl(int notationName,
int publicId,
int systemId)
Add a declaration for a notation |
int |
addUniqueLeafNode(int nameIndex)
create an XMLContentSpec for a leaf |
int |
addUnparsedEntityDecl(int name,
int publicId,
int systemId,
int notationName)
Add a declaration for an unparsed entity |
void |
callComment(int data)
Called when a comment has been scanned |
void |
callEndDTD()
End of DTD. |
void |
callProcessingInstruction(int piTarget,
int piData)
Called when a processing instruction has been scanned |
void |
callStartDTD()
Start of DTD. |
void |
callTextDecl(int version,
int encoding)
Signal the Text declaration of an external entity. |
void |
doctypeDecl(QName rootElement,
int publicId,
int systemId)
Called when the doctype decl is scanned |
void |
endEntityDecl()
End the scope of an entity declaration. |
void |
endEnumeration(int enumIndex)
Finish processing an enumeration |
boolean |
getAttributeDeclIsExternal(int attributeDeclIndex)
|
java.lang.String |
getContentSpecNodeAsString(int nodeIndex)
Create a string representation of an XMLContentSpec tree |
int |
getElementDeclIndex(QName element,
int scopeIndex)
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); } / |
boolean |
getElementDeclIsExternal(int elementDeclIndex)
|
boolean |
getRootElementQName(QName root)
|
void |
internalSubset(int internalSubset)
Supports DOM Level 2 internalSubset additions. |
protected boolean |
isDTD()
|
protected void |
putElementNameMapping(QName name,
int scope,
int elementDeclIndex)
|
void |
reset(StringPool stringPool)
Resets the DTD grammar. |
void |
setElementDeclDTD(int elementDeclIndex,
XMLElementDecl elementDecl)
|
void |
setElementDeclIsExternal(int elementDeclIndex,
boolean isExternal)
public void setContentSpecLeaf(int contentSpecIndex, QName elementName) { fTempContentSpec.setValues(XMLContentSpec.CONTENTSPECNODE_LEAF, elementName.rawname, -1); super.setContentSpec(contentSpecIndex, fTempContentSpec); } / |
boolean |
startEntityDecl(boolean isPE,
int entityName)
Start the scope of an entity declaration. |
int |
startEnumeration()
Called when the scanner start scanning an enumeration |
void |
startReadingFromExternalSubset(int publicId,
int systemId)
Called when the DTDScanner starts reading from the external subset |
void |
stopReadingFromExternalSubset()
Called when the DTDScanner stop reading from the external subset |
Methods inherited from class org.apache.xerces.validators.common.Grammar |
---|
clearContentModel, convertContentSpecTree, createAttributeDecl, createContentSpec, createElementDecl, existContentModel, getAttributeDecl, getContentModel, getContentSpec, getElementContentModel, getElementDecl, getElementDeclIndex, getElementDeclIndex, getFirstAttributeDeclIndex, getGrammarDocument, getNextAttributeDeclIndex, printAttributes, printElements, setAttributeDecl, setContentSpec, setElementDecl, setFirstAttributeDeclIndex, setGrammarDocument |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DTDGrammar(StringPool stringPool)
Method Detail |
public void reset(StringPool stringPool)
public void callStartDTD() throws java.lang.Exception
callStartDTD
in interface XMLDTDScanner.EventHandler
public void callEndDTD() throws java.lang.Exception
callEndDTD
in interface XMLDTDScanner.EventHandler
public void callTextDecl(int version, int encoding) throws java.lang.Exception
callTextDecl
in interface XMLDTDScanner.EventHandler
version
- the handle in the string pool for the version numberencoding
- the handle in the string pool for the encodingjava.lang.Exception
- public void doctypeDecl(QName rootElement, int publicId, int systemId) throws java.lang.Exception
doctypeDecl
in interface XMLDTDScanner.EventHandler
rootElementType
- handle of the rootElementpublicId
- StringPool handle of the public idsystemId
- StringPool handle of the system idjava.lang.Exception
- public void startReadingFromExternalSubset(int publicId, int systemId) throws java.lang.Exception
startReadingFromExternalSubset
in interface XMLDTDScanner.EventHandler
publicId
- StringPool handle of the public idsystemId
- StringPool handle of the system idjava.lang.Exception
- public void stopReadingFromExternalSubset() throws java.lang.Exception
stopReadingFromExternalSubset
in interface XMLDTDScanner.EventHandler
java.lang.Exception
- public int addElementDecl(QName elementDecl) throws java.lang.Exception
addElementDecl
in interface XMLDTDScanner.EventHandler
handle
- to the name of the element being declaredjava.lang.Exception
- public int addElementDecl(QName elementDecl, int contentSpecType, int contentSpec, boolean isExternal) throws java.lang.Exception
addElementDecl
in interface XMLDTDScanner.EventHandler
handle
- to the name of the element being declaredcontentSpecType
- handle to the type name of the content specContentSpec
- handle to the content spec node for the contentSpecTypejava.lang.Exception
- protected void putElementNameMapping(QName name, int scope, int elementDeclIndex)
putElementNameMapping
in class Grammar
public int getElementDeclIndex(QName element, int scopeIndex)
getElementDeclIndex
in class Grammar
public void setElementDeclDTD(int elementDeclIndex, XMLElementDecl elementDecl)
public void setElementDeclIsExternal(int elementDeclIndex, boolean isExternal)
public boolean getElementDeclIsExternal(int elementDeclIndex)
public boolean getAttributeDeclIsExternal(int attributeDeclIndex)
public boolean getRootElementQName(QName root)
public int addAttDef(QName elementDecl, QName attributeDecl, int attType, boolean attList, int enumeration, int attDefaultType, int attDefaultValue, boolean isExternal) throws java.lang.Exception
addAttDef
in interface XMLDTDScanner.EventHandler
handle
- to the element whose attribute is being declaredattName
- StringPool handle to the attribute name being declaredattType
- type of the attributeenumeration
- StringPool handle of the attribute's enumeration list (if any)attDefaultType
- an integer value denoting the DefaultDecl valueattDefaultValue
- StringPool handle of this attribute's default valuejava.lang.Exception
- public int addUniqueLeafNode(int nameIndex) throws java.lang.Exception
addUniqueLeafNode
in interface XMLDTDScanner.EventHandler
nameIndex
- StringPool handle to the name (Element) for the nodejava.lang.Exception
- public int addContentSpecNode(int nodeType, int nodeValue) throws java.lang.Exception
addContentSpecNode
in interface XMLDTDScanner.EventHandler
nodeType
- the type of XMLContentSpec to create - from XMLContentSpec.CONTENTSPECNODE_*nodeValue
- handle to an XMLContentSpecjava.lang.Exception
- public int addContentSpecNode(int nodeType, int leftNodeIndex, int rightNodeIndex) throws java.lang.Exception
addContentSpecNode
in interface XMLDTDScanner.EventHandler
nodeType
- the type of XMLContentSpec to create - from XMLContentSpec.CONTENTSPECNODE_*leftNodeIndex
- handle to an XMLContentSpecrightNodeIndex
- handle to an XMLContentSpecjava.lang.Exception
- public java.lang.String getContentSpecNodeAsString(int nodeIndex) throws java.lang.Exception
getContentSpecNodeAsString
in interface XMLDTDScanner.EventHandler
handle
- to an XMLContentSpecjava.lang.Exception
- public boolean startEntityDecl(boolean isPE, int entityName) throws java.lang.Exception
startEntityDecl
in interface XMLDTDScanner.EventHandler
true
on success; otherwise
false
if the entity declaration is recursive.java.lang.Exception
- public void endEntityDecl() throws java.lang.Exception
endEntityDecl
in interface XMLDTDScanner.EventHandler
java.lang.Exception
- public int addInternalPEDecl(int name, int value) throws java.lang.Exception
addInternalPEDecl
in interface XMLDTDScanner.EventHandler
name
- StringPool handle of the parameter entity namevalue
- StringPool handle of the parameter entity valuejava.lang.Exception
- public int addExternalPEDecl(int name, int publicId, int systemId) throws java.lang.Exception
addExternalPEDecl
in interface XMLDTDScanner.EventHandler
name
- StringPool handle of the parameter entity namepublicId
- StringPool handle of the publicIdsystemId
- StringPool handle of the systemIdjava.lang.Exception
- public int addInternalEntityDecl(int name, int value) throws java.lang.Exception
addInternalEntityDecl
in interface XMLDTDScanner.EventHandler
name
- StringPool handle of the entity namevalue
- StringPool handle of the entity valuejava.lang.Exception
- public int addExternalEntityDecl(int name, int publicId, int systemId) throws java.lang.Exception
addExternalEntityDecl
in interface XMLDTDScanner.EventHandler
name
- StringPool handle of the entity namepublicId
- StringPool handle of the publicIdsystemId
- StringPool handle of the systemIdjava.lang.Exception
- public int addUnparsedEntityDecl(int name, int publicId, int systemId, int notationName) throws java.lang.Exception
addUnparsedEntityDecl
in interface XMLDTDScanner.EventHandler
name
- StringPool handle of the entity namepublicId
- StringPool handle of the publicIdsystemId
- StringPool handle of the systemIdnotationName
- StringPool handle of the notationNamejava.lang.Exception
- public int startEnumeration() throws java.lang.Exception
startEnumeration
in interface XMLDTDScanner.EventHandler
java.lang.Exception
- public void addNameToEnumeration(int enumIndex, int elementType, int attrName, int nameIndex, boolean isNotationType) throws java.lang.Exception
addNameToEnumeration
in interface XMLDTDScanner.EventHandler
enumIndex
- StringPool handle to the string list for the enumerationelementType
- handle to the element that owns the attribute with the enumerationattrName
- StringPool handle to the name of the attribut with the enumerationnameIndex
- StringPool handle to the name to be added to the enumerationisNotationType
- true if the enumeration is an enumeration of NOTATION namesjava.lang.Exception
- public void endEnumeration(int enumIndex) throws java.lang.Exception
endEnumeration
in interface XMLDTDScanner.EventHandler
enumIndex
- handle to the string list which holds the enumeration to be finshed.java.lang.Exception
- public int addNotationDecl(int notationName, int publicId, int systemId) throws java.lang.Exception
addNotationDecl
in interface XMLDTDScanner.EventHandler
notationName
- publicId
- systemId
- java.lang.Exception
- public void callComment(int data) throws java.lang.Exception
callComment
in interface XMLDTDScanner.EventHandler
data
- StringPool handle of the comment textjava.lang.Exception
- public void callProcessingInstruction(int piTarget, int piData) throws java.lang.Exception
callProcessingInstruction
in interface XMLDTDScanner.EventHandler
piTarget
- StringPool handle of the PI targetpiData
- StringPool handle of the PI datajava.lang.Exception
- public void internalSubset(int internalSubset) throws java.lang.Exception
internalSubset
in interface XMLDTDScanner.EventHandler
protected boolean isDTD()
isDTD
in class Grammar
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |