Bassem Srouji wrote:
Hi

One more question.

How are we supposed to get the currently parsed line number from XMLDecl(...) 
method of an advanced handler class?
In v2.8 the advanced handlers do not have a setDocumentLocator() method, so the 
previously suggested solution that works just fine for normal handlers doesn't 
seem to apply to advanced ones!

And yeah, I know the xml declaration should be the first one in an XML file, 
but there can be an indefinite number of empty lines before the declaration 
itself...

Here's how I create my parser now (note the new installAdvDocHandler method 
call):

SAX2XMLReader* pParser = XMLReaderFactory::createXMLReader();
pParser->setContentHandler(MyOwnHandler);
pParser->setErrorHandler(MyOwnHandler);
pParser->setLexicalHandler(MyOwnHandler);
pParser->setEntityResolver(MyOwnHandler);

pParser->installAdvDocHandler(&MyAdvancedDocumentHandler);

and then I call the pParser->parse(MyFile.xml);

Any idea?
I think the only way you can do this is to have your ContentHandler derivative pass the Locator pointer to your XMLDocumentHandler derivate.

Dave

Reply via email to