XML for Java EA2

com.ibm.xml.parsers
Class DOMParser

java.lang.Object
  |
  +--com.ibm.xml.framework.XMLDocumentScanner
        |
        +--com.ibm.xml.framework.XMLParser
              |
              +--com.ibm.xml.parsers.DOMParser
Direct Known Subclasses:
RevalidatingDOMParser

public class DOMParser
extends XMLParser

Version:
%M% %I% %W% %Q%

Field Summary
static java.lang.String DEFAULT_DOCUMENT_CLASS_NAME
          Default programmatic document class name (com.ibm.xml.dom.DocumentImpl).
protected  int fAmpIndex
           
protected  int fAposIndex
           
protected  Node fCurrentElementNode
           
protected  int fCurrentNodeIndex
           
protected  DeferredDocumentImpl fDeferredDocumentImpl
           
protected  Document fDocument
           
protected  DocumentImpl fDocumentImpl
           
protected  int fDocumentIndex
           
protected  DocumentType fDocumentType
           
protected  int fDocumentTypeIndex
           
protected  int fGtIndex
           
protected  boolean fInCDATA
           
protected  int fLtIndex
           
protected  int fQuotIndex
           
protected  boolean fWithinElement
           
 
Fields inherited from class com.ibm.xml.framework.XMLParser
fNamespacesEnabled, fNamespaceSep, fParseInProgress, fValidator, SAX2_FEATURES_PREFIX, SAX2_HANDLERS_PREFIX, SAX2_PROPERTIES_PREFIX, XML4J_FEATURES_PREFIX, XML4J_PROPERTIES_PREFIX
 
Fields inherited from class com.ibm.xml.framework.XMLDocumentScanner
fCurrentElementEntity, fCurrentElementType, fElementDepth, fEntityHandler, fEntityReader, fErrorReporter, fInElementContent, fReaderId, fStringPool, SCANNER_STATE_ATTRIBUTE_LIST, SCANNER_STATE_ATTRIBUTE_NAME, SCANNER_STATE_ATTRIBUTE_VALUE, SCANNER_STATE_COMMENT, SCANNER_STATE_CONTENT, SCANNER_STATE_DOCTYPE, SCANNER_STATE_ELEMENT, SCANNER_STATE_MISC_OR_DOCTYPE, SCANNER_STATE_MISC_OR_ROOT_ELEMENT, SCANNER_STATE_PI, SCANNER_STATE_SETUP, SCANNER_STATE_START_OF_MARKUP, SCANNER_STATE_STRING_LITERAL, SCANNER_STATE_TRAILING_MISC, SCANNER_STATE_UNKNOWN, SCANNER_STATE_XML_DECL
 
Constructor Summary
DOMParser()
          Default constructor.
 
Method Summary
 void attlistDecl(int elementTypeIndex, int attrNameIndex, int attType, java.lang.String enumString, int attDefaultType, int attDefaultValue)
          <!ATTLIST Name AttDef>
 void characters(char[] ch, int start, int length)
          Not called.
 void characters(int dataIndex)
          Characters.
 void comment(int dataIndex)
          Comment.
 void elementDecl(int elementTypeIndex, java.lang.String contentModel)
          <!ELEMENT Name contentspec>
 void endCDATA()
          End CDATA section.
 void endDocument()
          End document.
 void endDTD()
          This function will be called at the end of the DTD.
 void endElement(int elementTypeIndex)
          End element.
 void endEntityReference(int entityName, int entityType, int entityContext)
          End entity reference.
 void endNamespaceDeclScope(int prefix)
          Report the end of the scope of a namespace declaration.
 void externalEntityDecl(int entityName, int publicId, int systemId)
          <!ENTITY Name ExternalID> (external)
 void externalPEDecl(int entityName, int publicId, int systemId)
          <!ENTITY % Name ExternalID> (external)
 boolean getCreateEntityReferenceNodes()
           
protected  Element getCurrentElementNode()
          Returns the current element node.
protected  boolean getDeferNodeExpansion()
          Returns true if the expansion of the nodes in the default DOM implementation are deferred.
 Document getDocument()
          Returns the document.
protected  java.lang.String getDocumentClassName()
          Returns the fully qualified class name of the document factory used when constructing the DOM tree.
 boolean getFeature(java.lang.String featureId)
          Query the current state of any feature in a SAX2 parser.
 java.lang.String[] getFeaturesRecognized()
          Returns a list of features that this parser recognizes.
 java.lang.String[] getPropertiesRecognized()
          Returns a list of properties that this parser recognizes.
 java.lang.Object getProperty(java.lang.String propertyId)
          Return the current value of a property in a SAX2 parser.
 void ignorableWhitespace(char[] ch, int start, int length)
          Not called.
 void ignorableWhitespace(int dataIndex)
          Ignorable whitespace.
protected  void init()
          Initializes the parser to a pre-parse state.
 void internalEntityDecl(int entityName, int entityValue)
          <!ENTITY Name EntityValue> (internal)
 void internalPEDecl(int entityName, int entityValue)
          <!ENTITY % Name EntityValue> (internal)
 void notationDecl(int notationName, int publicId, int systemId)
          <!NOTATION Name ExternalId>
 void processingInstruction(int targetIndex, int dataIndex)
          Processing instruction.
 void reset()
          Resets the parser.
 void resetOrCopy()
          Resets or copies the parser.
protected  void setCreateEntityReferenceNodes(boolean create)
          This feature determines whether entity references within the document are included in the document tree as EntityReference nodes.
protected  void setDeferNodeExpansion(boolean deferNodeExpansion)
          This method sets whether the expansion of the nodes in the default DOM implementation are deferred.
protected  void setDocumentClassName(java.lang.String documentClassName)
          This method allows the programmer to decide which document factory to use when constructing the DOM tree.
 void setFeature(java.lang.String featureId, boolean state)
          Set the state of any feature in a SAX2 parser.
 void setProperty(java.lang.String propertyId, java.lang.Object value)
          Set the value of any property in a SAX2 parser.
 void startCDATA()
          Start CDATA section.
 void startDocument(int versionIndex, int encodingIndex, int standAloneIndex)
          Start document.
 void startDTD(int rootElementType, int publicId, int systemId)
          This function will be called when a <!DOCTYPE...> declaration is encountered.
 void startElement(int elementTypeIndex, XMLAttrList xmlAttrList, int attrListIndex)
          Start element.
 void startEntityReference(int entityName, int entityType, int entityContext)
          Start entity reference.
 void startNamespaceDeclScope(int prefix, int uri)
          Report the start of the scope of a namespace declaration.
 void unparsedEntityDecl(int entityName, int publicId, int systemId, int notationName)
          <!ENTITY Name ExternalID NDataDecl> (unparsed)
 
Methods inherited from class com.ibm.xml.framework.XMLParser
addAttrForElement, callCharacters, callComment, callEndDocument, callEndElement, callProcessingInstruction, callStartDocument, callStartElement, commentInDTD, elementSpecified, getAllowJavaEncodings, getColumnNumber, getContinueAfterFatalError, getEntityHandler, getExternalGeneralEntities, getExternalParameterEntities, getLineNumber, getLocator, getNamespaces, getNamespaceSep, getPublicId, getSchemaValidator, getSystemId, getValidation, getValidationDynamic, getValidationWarnOnDuplicateAttdef, getValidationWarnOnUndeclaredElemdef, getXMLString, isFeatureRecognized, isPropertyRecognized, literalDataAppend, literalDataAppend, literalDataAppend, literalDataIndex, literalDataLength, loadCatalog, parse, parse, parseSomeSetup, processCharacters, processCharacters, processingInstructionInDTD, processWhitespace, processWhitespace, reportError, scanAttributeName, scanAttValue, scanDoctypeDecl, scanElementType, scanExpectedElementType, setAllowJavaEncodings, setCharDataInterest, setContinueAfterFatalError, setEntityResolver, setErrorHandler, setExternalGeneralEntities, setExternalParameterEntities, setLocale, setLocator, setNamespaces, setNamespaceSep, setValidating, setValidation, setValidationDynamic, setValidationWarnOnDuplicateAttdef, setValidationWarnOnUndeclaredElemdef, validEncName, validVersionNum
 
Methods inherited from class com.ibm.xml.framework.XMLDocumentScanner
abortMarkup, abortMarkup, abortMarkup, abortMarkup, checkXMLLangAttributeValue, decreaseMarkupDepth, endOfInput, getScannerState, increaseMarkupDepth, markupDepth, parseSome, readerChange, reportFatalXMLError, reportFatalXMLError, reportFatalXMLError, reportFatalXMLError, reportFatalXMLError, reportFatalXMLError, scanComplexAttValue, setEntityHandler, setErrorReporter, skipPastEndOfCurrentMarkup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DOCUMENT_CLASS_NAME

public static final java.lang.String DEFAULT_DOCUMENT_CLASS_NAME
Default programmatic document class name (com.ibm.xml.dom.DocumentImpl).

fDocument

protected Document fDocument

fDeferredDocumentImpl

protected DeferredDocumentImpl fDeferredDocumentImpl

fDocumentIndex

protected int fDocumentIndex

fDocumentTypeIndex

protected int fDocumentTypeIndex

fCurrentNodeIndex

protected int fCurrentNodeIndex

fDocumentImpl

protected DocumentImpl fDocumentImpl

fDocumentType

protected DocumentType fDocumentType

fCurrentElementNode

protected Node fCurrentElementNode

fWithinElement

protected boolean fWithinElement

fInCDATA

protected boolean fInCDATA

fAmpIndex

protected int fAmpIndex

fLtIndex

protected int fLtIndex

fGtIndex

protected int fGtIndex

fAposIndex

protected int fAposIndex

fQuotIndex

protected int fQuotIndex
Constructor Detail

DOMParser

public DOMParser()
Default constructor.
Method Detail

getDocument

public Document getDocument()
Returns the document.

getFeaturesRecognized

public java.lang.String[] getFeaturesRecognized()
Returns a list of features that this parser recognizes. This method will never return null; if no features are recognized, this method will return a zero length array.
Overrides:
getFeaturesRecognized in class XMLParser
See Also:
XMLParser.isFeatureRecognized(java.lang.String), setFeature(java.lang.String, boolean), getFeature(java.lang.String)

getPropertiesRecognized

public java.lang.String[] getPropertiesRecognized()
Returns a list of properties that this parser recognizes. This method will never return null; if no properties are recognized, this method will return a zero length array.
Overrides:
getPropertiesRecognized in class XMLParser
See Also:
XMLParser.isPropertyRecognized(java.lang.String), setProperty(java.lang.String, java.lang.Object), getProperty(java.lang.String)

reset

public void reset()
           throws java.lang.Exception
Resets the parser.
Overrides:
reset in class XMLParser

resetOrCopy

public void resetOrCopy()
                 throws java.lang.Exception
Resets or copies the parser.
Overrides:
resetOrCopy in class XMLParser

init

protected void init()
Initializes the parser to a pre-parse state. This method is called between calls to parse().

setDeferNodeExpansion

protected void setDeferNodeExpansion(boolean deferNodeExpansion)
This method sets whether the expansion of the nodes in the default DOM implementation are deferred.
See Also:
getDeferNodeExpansion(), setDocumentClassName(java.lang.String)

getDeferNodeExpansion

protected boolean getDeferNodeExpansion()
Returns true if the expansion of the nodes in the default DOM implementation are deferred.
See Also:
setDeferNodeExpansion(boolean)

setCreateEntityReferenceNodes

protected void setCreateEntityReferenceNodes(boolean create)
This feature determines whether entity references within the document are included in the document tree as EntityReference nodes.

Note: The children of the entity reference are always added to the document. This feature only affects whether an EntityReference node is also included as the parent of the entity reference children.

Parameters:
create - True to create entity reference nodes; false to only insert the entity reference children.
See Also:
getCreateEntityReferenceNodes()

getCreateEntityReferenceNodes

public boolean getCreateEntityReferenceNodes()
See Also:
setCreateEntityReferenceNodes(boolean)

setDocumentClassName

protected void setDocumentClassName(java.lang.String documentClassName)
This method allows the programmer to decide which document factory to use when constructing the DOM tree. However, doing so will lose the functionality of the default factory. Also, a document class other than the default will lose the ability to defer node expansion on the DOM tree produced.
Parameters:
documentClassName - The fully qualified class name of the document factory to use when constructing the DOM tree.
See Also:
getDocumentClassName(), setDeferNodeExpansion(boolean), DEFAULT_DOCUMENT_CLASS_NAME

getDocumentClassName

protected java.lang.String getDocumentClassName()
Returns the fully qualified class name of the document factory used when constructing the DOM tree.
See Also:
setDocumentClassName(java.lang.String)

getCurrentElementNode

protected Element getCurrentElementNode()
Returns the current element node.

Note: This method is not supported when the "deferNodeExpansion" property is set to true and the document factory is set to the default factory.


setFeature

public void setFeature(java.lang.String featureId,
                       boolean state)
                throws SAXException
Set the state of any feature in a SAX2 parser. The parser might not recognize the feature, and if it does recognize it, it might not be able to fulfill the request.
Parameters:
featureId - The unique identifier (URI) of the feature.
state - The requested state of the feature (true or false).
Throws:
SAXNotRecognizedException - If the requested feature is not known.
SAXNotSupportedException - If the requested feature is known, but the requested state is not supported.
SAXException - If there is any other problem fulfilling the request.
Overrides:
setFeature in class XMLParser

getFeature

public boolean getFeature(java.lang.String featureId)
                   throws SAXException
Query the current state of any feature in a SAX2 parser. The parser might not recognize the feature.
Parameters:
featureId - The unique identifier (URI) of the feature being set.
Returns:
The current state of the feature.
Throws:
SAXNotRecognizedException - If the requested feature is not known.
SAXException - If there is any other problem fulfilling the request.
Overrides:
getFeature in class XMLParser

setProperty

public void setProperty(java.lang.String propertyId,
                        java.lang.Object value)
                 throws SAXException
Set the value of any property in a SAX2 parser. The parser might not recognize the property, and if it does recognize it, it might not support the requested value.
Parameters:
propertyId - The unique identifier (URI) of the property being set.
Object - The value to which the property is being set.
Throws:
SAXNotRecognizedException - If the requested property is not known.
SAXNotSupportedException - If the requested property is known, but the requested value is not supported.
SAXException - If there is any other problem fulfilling the request.
Overrides:
setProperty in class XMLParser

getProperty

public java.lang.Object getProperty(java.lang.String propertyId)
                             throws SAXException
Return the current value of a property in a SAX2 parser. The parser might not recognize the property.
Parameters:
propertyId - The unique identifier (URI) of the property being set.
Returns:
The current value of the property.
Throws:
SAXNotRecognizedException - If the requested property is not known.
SAXException - If there is any other problem fulfilling the request.
Overrides:
getProperty in class XMLParser
See Also:
Configurable.getProperty(java.lang.String)

startDocument

public void startDocument(int versionIndex,
                          int encodingIndex,
                          int standAloneIndex)
Start document.
Overrides:
startDocument in class XMLParser

endDocument

public void endDocument()
                 throws java.lang.Exception
End document.
Overrides:
endDocument in class XMLParser

startNamespaceDeclScope

public void startNamespaceDeclScope(int prefix,
                                    int uri)
                             throws java.lang.Exception
Report the start of the scope of a namespace declaration.
Overrides:
startNamespaceDeclScope in class XMLParser

endNamespaceDeclScope

public void endNamespaceDeclScope(int prefix)
                           throws java.lang.Exception
Report the end of the scope of a namespace declaration.
Overrides:
endNamespaceDeclScope in class XMLParser

startElement

public void startElement(int elementTypeIndex,
                         XMLAttrList xmlAttrList,
                         int attrListIndex)
                  throws java.lang.Exception
Start element.
Overrides:
startElement in class XMLParser

endElement

public void endElement(int elementTypeIndex)
                throws java.lang.Exception
End element.
Overrides:
endElement in class XMLParser

characters

public void characters(int dataIndex)
                throws java.lang.Exception
Characters.
Overrides:
characters in class XMLParser

ignorableWhitespace

public void ignorableWhitespace(int dataIndex)
                         throws java.lang.Exception
Ignorable whitespace.
Overrides:
ignorableWhitespace in class XMLParser

processingInstruction

public void processingInstruction(int targetIndex,
                                  int dataIndex)
                           throws java.lang.Exception
Processing instruction.
Overrides:
processingInstruction in class XMLParser

comment

public void comment(int dataIndex)
             throws java.lang.Exception
Comment.
Overrides:
comment in class XMLParser

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws java.lang.Exception
Not called.
Overrides:
characters in class XMLParser

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws java.lang.Exception
Not called.
Overrides:
ignorableWhitespace in class XMLParser

startCDATA

public void startCDATA()
                throws java.lang.Exception
Start CDATA section.
Overrides:
startCDATA in class XMLParser

endCDATA

public void endCDATA()
              throws java.lang.Exception
End CDATA section.
Overrides:
endCDATA in class XMLParser

startEntityReference

public void startEntityReference(int entityName,
                                 int entityType,
                                 int entityContext)
                          throws java.lang.Exception
Start entity reference.

endEntityReference

public void endEntityReference(int entityName,
                               int entityType,
                               int entityContext)
                        throws java.lang.Exception
End entity reference.

startDTD

public void startDTD(int rootElementType,
                     int publicId,
                     int systemId)
              throws java.lang.Exception
This function will be called when a <!DOCTYPE...> declaration is encountered.
Overrides:
startDTD in class XMLParser

endDTD

public void endDTD()
            throws java.lang.Exception
This function will be called at the end of the DTD.
Overrides:
endDTD in class XMLParser

elementDecl

public void elementDecl(int elementTypeIndex,
                        java.lang.String contentModel)
                 throws java.lang.Exception
<!ELEMENT Name contentspec>
Overrides:
elementDecl in class XMLParser

attlistDecl

public void attlistDecl(int elementTypeIndex,
                        int attrNameIndex,
                        int attType,
                        java.lang.String enumString,
                        int attDefaultType,
                        int attDefaultValue)
                 throws java.lang.Exception
<!ATTLIST Name AttDef>
Overrides:
attlistDecl in class XMLParser

internalPEDecl

public void internalPEDecl(int entityName,
                           int entityValue)
                    throws java.lang.Exception
<!ENTITY % Name EntityValue> (internal)
Overrides:
internalPEDecl in class XMLParser

externalPEDecl

public void externalPEDecl(int entityName,
                           int publicId,
                           int systemId)
                    throws java.lang.Exception
<!ENTITY % Name ExternalID> (external)
Overrides:
externalPEDecl in class XMLParser

internalEntityDecl

public void internalEntityDecl(int entityName,
                               int entityValue)
                        throws java.lang.Exception
<!ENTITY Name EntityValue> (internal)
Overrides:
internalEntityDecl in class XMLParser

externalEntityDecl

public void externalEntityDecl(int entityName,
                               int publicId,
                               int systemId)
                        throws java.lang.Exception
<!ENTITY Name ExternalID> (external)
Overrides:
externalEntityDecl in class XMLParser

unparsedEntityDecl

public void unparsedEntityDecl(int entityName,
                               int publicId,
                               int systemId,
                               int notationName)
                        throws java.lang.Exception
<!ENTITY Name ExternalID NDataDecl> (unparsed)
Overrides:
unparsedEntityDecl in class XMLParser

notationDecl

public void notationDecl(int notationName,
                         int publicId,
                         int systemId)
                  throws java.lang.Exception
<!NOTATION Name ExternalId>
Overrides:
notationDecl in class XMLParser

XML for Java EA2