XML for Java 2.0.15

com.ibm.xml.parsers
Class NonValidatingDOMParser

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

public class NonValidatingDOMParser
extends XMLParser

Version:
63 1.24 src/com/ibm/xml/parsers/NonValidatingDOMParser.java, parser, xml4j2, xml4j2_0_15

Field Summary
static java.lang.String DEFAULT_DOCUMENT_CLASS
          Default programmatic document class.
static int DEFERRED
          Represents deferred DOM Node expansion of Node objects and data.
protected  AttrPool fAttrPool
           
protected  Node fCurrentNode
           
protected  int fCurrentNodeIndex
           
protected  DeferredDocumentImpl fDeferredDocumentImpl
           
protected  Document fDocument
           
protected  java.lang.String fDocumentClass
           
protected  DocumentImpl fDocumentImpl
           
protected  int fDocumentIndex
           
protected  DocumentType fDocumentType
           
protected  int fDocumentTypeIndex
           
protected  ElementDeclPool fElementDeclPool
           
protected  EntityPool fEntityPool
           
protected  boolean fExpandEntityReferences
           
protected  int fNodeExpansion
           
protected  java.util.Stack fNodeStack
           
protected  boolean fRootElement
           
protected  StringPool fStringPool
           
static int FULL
          Represents full DOM Node expansion of Node objects and data.
protected  boolean fWithinElement
           
 
Fields inherited from class com.ibm.xml.framework.XMLParser
fLocale, fNeedReset, fParseInProgress, fResourceBundle, fScanner
 
Constructor Summary
NonValidatingDOMParser()
          Default constructor.
 
Method Summary
 void attlistDecl(int elementIndex, int attDefIndex)
          <!ATTLIST Name AttDef>
 void characters(char[] ch, int start, int length, boolean cdataSection)
          Not called.
 void characters(int dataIndex, boolean cdataSection)
          Characters.
protected  void checkHandlers()
           
 void comment(int dataIndex)
          Comment.
 void doctypeDecl(int rootElementNameIndex)
          This function will be called when a <!DOCTYPE...> declaration is encountered.
 void elementDecl(int elementIndex)
          <!ELEMENT Name contentspec>
 void endDocument()
          End document.
 void endElement(int elementNameIndex)
          End element.
 void endEntityReference(int entityIndex)
          End entity reference.
 void endExternalSubset()
          This function will be called at the end of the "external subset" of a doctype declaration.
 void endInternalSubset()
          This function will be called at the end of the "internal subset" of a doctype declaration.
 void externalEntityDecl(int entityIndex)
          <!ENTITY Name ExternalID> (external)
 Node getCurrentNode()
          Return the current DOM Node.
 Document getDocument()
          Returns the document.
 boolean getExpandEntityReferences()
          Return a boolean which says whether EntityReference Nodes are expanded (replaced) by this parser.
 int getNodeExpansion()
          Return the Node expansion level integer mapping to the constants in DOMParser.
 void ignorableWhitespace(char[] ch, int start, int length, boolean cdataSection)
          Not called.
 void ignorableWhitespace(int dataIndex, boolean cdataSection)
          Ignorable whitespace.
protected  void init(ParserState state)
           
 void internalEntityDecl(int entityIndex)
          <!ENTITY Name EntityValue> (internal)
 void notationDecl(int notationIndex)
          <!NOTATION Name ExternalId>
 void parameterEntityDecl(int entityIndex)
           
 void parse(InputSource source)
          Parses the specified input source.
 void processingInstruction(int targetIndex, int dataIndex)
          Processing instruction.
 void reset()
           
protected  void resetOrCopy()
           
 void setDocumentClass(java.lang.String documentClass)
          This allows the programmer to decide which document factory to use when constructing the DOM tree.
 void setExpandEntityReferences(boolean expand)
          Sets whether EntityReference Nodes are expanded (replaced) by this parser.
 void setNodeExpansion(int nodeExpansion)
          Sets whether Nodes are created and the data is kept within the Nodes.
 void startDocument(int versionIndex, int encodingIndex, int standAloneIndex)
          Start document.
 void startElement(int elementNameIndex, int attrListIndex)
          Start element.
 void startEntityReference(int entityIndex)
          Start entity reference.
 void startExternalSubset(int publicIdStringIndex, int systemIdStringIndex)
          This function will be called at the start of the "external subset" of a doctype declaration.
 void startInternalSubset()
          This function will be called at the start of the "internal subset" of a doctype declaration.
 void unparsedEntityDecl(int entityIndex)
          <!ENTITY Name ExternalID NDataDecl> (unparsed)
 
Methods inherited from class com.ibm.xml.framework.XMLParser
error, error1, error2, error3, error4, errorHandlingEnabled, getAllowJavaEncodingName, getCheckNamespace, getContinueAfterFatalError, getDocumentHandler, getDocumentTypeHandler, getEntityHandler, getErrorHandler, getErrorMsgString, getLocator, getParserState, getScanner, getValidationHandler, getWarningOnDuplicateAttDef, handleError, isFatal, isWarning, loadCatalog, parse, sendCharDataAsCharArray, setAllowJavaEncodingName, setCheckNamespace, setContinueAfterFatalError, setDocumentHandler, setDocumentHandler, setDocumentTypeHandler, setDTDHandler, setEntityHandler, setEntityResolver, setErrorHandler, setLocale, setValidationHandler, setWarningOnDuplicateAttDef, useDefaultValidationHandler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FULL

public static final int FULL
Represents full DOM Node expansion of Node objects and data.

DEFERRED

public static final int DEFERRED
Represents deferred DOM Node expansion of Node objects and data.

DEFAULT_DOCUMENT_CLASS

public static final java.lang.String DEFAULT_DOCUMENT_CLASS
Default programmatic document class.

fDocumentIndex

protected int fDocumentIndex

fDocumentTypeIndex

protected int fDocumentTypeIndex

fCurrentNodeIndex

protected int fCurrentNodeIndex

fDocumentType

protected DocumentType fDocumentType

fCurrentNode

protected Node fCurrentNode

fNodeStack

protected java.util.Stack fNodeStack

fDocument

protected Document fDocument

fDocumentImpl

protected DocumentImpl fDocumentImpl

fDeferredDocumentImpl

protected DeferredDocumentImpl fDeferredDocumentImpl

fExpandEntityReferences

protected boolean fExpandEntityReferences

fNodeExpansion

protected int fNodeExpansion

fWithinElement

protected boolean fWithinElement

fAttrPool

protected AttrPool fAttrPool

fElementDeclPool

protected ElementDeclPool fElementDeclPool

fEntityPool

protected EntityPool fEntityPool

fStringPool

protected StringPool fStringPool

fDocumentClass

protected java.lang.String fDocumentClass

fRootElement

protected boolean fRootElement
Constructor Detail

NonValidatingDOMParser

public NonValidatingDOMParser()
Default constructor.
Method Detail

reset

public void reset()
Overrides:
reset in class XMLParser

resetOrCopy

protected void resetOrCopy()
Overrides:
resetOrCopy in class XMLParser

init

protected void init(ParserState state)

checkHandlers

protected void checkHandlers()
                      throws java.lang.Exception
Overrides:
checkHandlers in class XMLParser

setExpandEntityReferences

public void setExpandEntityReferences(boolean expand)
Sets whether EntityReference Nodes are expanded (replaced) by this parser. Expanded means that the children of the EntityReference Node replace it.

The default value is false, EntityReference Nodes are kept.

Parameters:
keep - =true means expanding entity references; =false means maintain entity references.
See Also:
EntityReference, GeneralReference

getExpandEntityReferences

public boolean getExpandEntityReferences()
Return a boolean which says whether EntityReference Nodes are expanded (replaced) by this parser. Expanded means that the children of the EntityReference Node replace it.

The default value is false, EntityReference Nodes are kept.

Parameters:
keep - =true means expanding entity references; =false means maintain entity references.
See Also:
EntityReference, GeneralReference

setNodeExpansion

public void setNodeExpansion(int nodeExpansion)
Sets whether Nodes are created and the data is kept within the Nodes.

Parameters:
nodeExpansion -
NonValidatingDOMParser.FULL - full expansion NonValidatingDOMParser.DEFERRED - deferred expansion

getNodeExpansion

public int getNodeExpansion()
Return the Node expansion level integer mapping to the constants in DOMParser. Signifies whether DOM Nodes are created and the data is kept within the Nodes.

Parameters:
nodeExpansion -
DOMParser.FULL - full expansion DOMParser.DEFERRED - deferred expansion

getCurrentNode

public Node getCurrentNode()
Return the current DOM Node.

This function will only return meaningful Node values when setNodeExpansion(FULL). When setNodeExpansion(DEFERRED) is set, Node creation is deferred and getCurrentNode() will likely return null.

This function is useful for querying the parser when getting an error or warning callback.

See Also:
setNodeExpansion(int)

doctypeDecl

public void doctypeDecl(int rootElementNameIndex)
                 throws java.lang.Exception
This function will be called when a <!DOCTYPE...> declaration is encountered.

startInternalSubset

public void startInternalSubset()
                         throws java.lang.Exception
This function will be called at the start of the "internal subset" of a doctype declaration.

endInternalSubset

public void endInternalSubset()
                       throws java.lang.Exception
This function will be called at the end of the "internal subset" of a doctype declaration.

startExternalSubset

public void startExternalSubset(int publicIdStringIndex,
                                int systemIdStringIndex)
                         throws java.lang.Exception
This function will be called at the start of the "external subset" of a doctype declaration.

endExternalSubset

public void endExternalSubset()
                       throws java.lang.Exception
This function will be called at the end of the "external subset" of a doctype declaration.

elementDecl

public void elementDecl(int elementIndex)
                 throws java.lang.Exception
<!ELEMENT Name contentspec>

attlistDecl

public void attlistDecl(int elementIndex,
                        int attDefIndex)
                 throws java.lang.Exception
<!ATTLIST Name AttDef>

internalEntityDecl

public void internalEntityDecl(int entityIndex)
                        throws java.lang.Exception
<!ENTITY Name EntityValue> (internal)

externalEntityDecl

public void externalEntityDecl(int entityIndex)
                        throws java.lang.Exception
<!ENTITY Name ExternalID> (external)

unparsedEntityDecl

public void unparsedEntityDecl(int entityIndex)
                        throws java.lang.Exception
<!ENTITY Name ExternalID NDataDecl> (unparsed)

notationDecl

public void notationDecl(int notationIndex)
                  throws java.lang.Exception
<!NOTATION Name ExternalId>

parameterEntityDecl

public void parameterEntityDecl(int entityIndex)

setDocumentClass

public void setDocumentClass(java.lang.String documentClass)
This allows the programmer to decide which document factory to use when constructing the DOM tree. However, doing so will lose the parsing performance gain of the default factory.

Note: Setting the document class name to any other document class besides the default class will switch the node expansion to FULL.

Parameters:
documentClass - The fully qualified class name of the document factory to use when constructing the DOM tree.
See Also:
#DEFERRED_DOCUMENT_CLASS, setNodeExpansion(int), FULL

getDocument

public Document getDocument()
Returns the document.

startDocument

public void startDocument(int versionIndex,
                          int encodingIndex,
                          int standAloneIndex)
Start document.

endDocument

public void endDocument()
                 throws java.lang.Exception
End document.

startElement

public void startElement(int elementNameIndex,
                         int attrListIndex)
                  throws java.lang.Exception
Start element.

endElement

public void endElement(int elementNameIndex)
                throws java.lang.Exception
End element.

startEntityReference

public void startEntityReference(int entityIndex)
                          throws java.lang.Exception
Start entity reference.

endEntityReference

public void endEntityReference(int entityIndex)
                        throws java.lang.Exception
End entity reference.

characters

public void characters(int dataIndex,
                       boolean cdataSection)
                throws java.lang.Exception
Characters.

ignorableWhitespace

public void ignorableWhitespace(int dataIndex,
                                boolean cdataSection)
                         throws java.lang.Exception
Ignorable whitespace.

processingInstruction

public void processingInstruction(int targetIndex,
                                  int dataIndex)
                           throws java.lang.Exception
Processing instruction.

comment

public void comment(int dataIndex)
             throws java.lang.Exception
Comment.

characters

public void characters(char[] ch,
                       int start,
                       int length,
                       boolean cdataSection)
                throws java.lang.Exception
Not called.

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length,
                                boolean cdataSection)
                         throws java.lang.Exception
Not called.

parse

public void parse(InputSource source)
           throws SAXException,
                  java.io.IOException
Parses the specified input source.
Parameters:
source - The input source.
Throws:
SAXException - Throws exception on SAX error.
java.io.IOException - Throws exception on i/o error.
Overrides:
parse in class XMLParser

XML for Java 2.0.15