startDocument Method


Receives notification of the beginning of a document. The reader invokes the startDocument method only once.

The startDocument method is invoked before any other methods in the IVBSAXContentHandler interface or in the IVBSAXDTDHandler interface. Only the documentLocator property is invoked before the startDocument method.

Visual Basic Implementation Syntax

Sub startDocument

Visual Basic Usage Syntax


Return Values

If failed, the ContentHandler raises a trappable error.


The following example uses the startDocument method to set the text property for a text box (Text1) on the main application form (Form1). The new text indicates that the reader has begun reading the document.

Private Sub IVBSAXContentHandler_startDocument()
    Form1.Text1.Text = "Starting document." & vbCrLf
End Sub

The startDocument method is invoked before any other methods in the ISAXContentHandler interface or in the ISAXDTDHandler interface, with the exception of the putDocumentLocator method.

C/C++ Syntax

HRESULT startDocument();  

Return Values

The value returned if successful.

The value returned if the parse operation should be aborted.


Implemented in: MSXML 3.0 and later

Applies to

ISAXContentHandler Interface

See Also

documentLocator Property (Visual Basic)
endDocument Method
ISAXDTDHandler Interface
putDocumentLocator Method (C-C++)