Partager via


putDocumentLocator Method (C-C++)

 

Receives an interface for locating the origin of Simple API for XML (SAX) document events. The reader supplies a locator to the application by invoking this method before invoking any other methods in the ISAXContentHandler interface. This locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error. Typically, the application uses this information to report its own errors (for example, if the character content does not match the business rules of the application).

Syntax

HRESULT putDocumentLocator(  
   [in] ISAXLocator * pLocator);  

Parameters

pLocator[in]
A pointer to a valid instance of the ISAXLocator interface.

Return Values

S_OK
The value returned if no errors occur.

E_FAIL
The value returned if the parse operation should be aborted.

Remarks

The information returned by the Locator object can sometimes be insufficient for use with a search engine. The locator returns the correct information only during the invocation of events in this interface. The application should not attempt to use this method at any other time.

If you assign pLocator to a smart (reference-counted) pointer (CComPtr), you should explicitly release the smart pointer before releasing the class instance. An alternative to assigning pLocator to a smart pointer would be to use the pLocator value in the body of putDocumentLocator.

Versioning

Implemented in: MSXML 3.0 and later

Applies to

ISAXContentHandler Interface

See Also

ISAXLocator Interface
startDocument Method