David Bertoni wrote:
> Stephen Collyer wrote:

>> I guess you mean setDocumentLocator() ?
>>
>> So to use this, I create a Locator object, pass it to
>> setDocumentLocator(). Then the Xerces parser code will
>> set the appropriate error info, which I can retrieve
>> in, say, the warning(), error() methods of an error
>> handler class ?
>>
> Yes, that's the right call, but you've reversed what you need to do. 
> Your ContentHandler implementation should override setDocumentLocator()
> and store that pointer. 

Right. So the only thing that needs to happen in the overridden
method is the storing of the pointer that's passed in ?

> Then, during parsing callbacks (and only during
> them), you can call the accessor functions to get the information you
> need. 

By "parsing callbacks" I guess you mean start_document(),
start_element() and so on ?

> The parser has to provide you with an instance of a Locator,
> since it's parsing the document.

Well, I guess it could work the other way round - the
implementation could expect the Locator* to be passed when
the parser is created. However, given that the parser creates
the Locator, then I suppose it also deletes it ? i.e. the
content handler need not do that ?

-- 
Regards

Steve Collyer
Netspinner Ltd

Reply via email to