JP GOBLET
December 12th, 2003, 11:15 AM
I use a ISAXXMLReader to locate the line & column number of a IXMLDOMNode;
for that i use a ISAXLocator that is transmitted to the ContentHandler :
// create a reader & ContentHandler:
ISAXXMLReaderPtr pReader;
HRESULT hr = pReader.CreateInstance(__uuidof(SAXXMLReader40));
MyContentHandler *pMyContentHandler = new MyContentHandler();
hr = pReader->putContentHandler(pMc);
// create a ISAXLocator & put it to the ContentHandler :
ISAXLocatorPtr pLocator;
hr = pLocator.CreateInstance(__uuidof(ISAXLocator)); // -> hr = -2147221164
pMyContentHandler->putDocumentLocator(pLocator);
// pass a node to the parser :
_variant_t v;
v.vt = VT_DISPATCH;
v.pdispVal = pNode;
pNode->AddRef();
hr = pReader->parse(v);
The parser works (it directly goes to the specifed node),
but pLocator.CreateInstance fails (hr = -2147221164). What's wrong with it ?
JPG
for that i use a ISAXLocator that is transmitted to the ContentHandler :
// create a reader & ContentHandler:
ISAXXMLReaderPtr pReader;
HRESULT hr = pReader.CreateInstance(__uuidof(SAXXMLReader40));
MyContentHandler *pMyContentHandler = new MyContentHandler();
hr = pReader->putContentHandler(pMc);
// create a ISAXLocator & put it to the ContentHandler :
ISAXLocatorPtr pLocator;
hr = pLocator.CreateInstance(__uuidof(ISAXLocator)); // -> hr = -2147221164
pMyContentHandler->putDocumentLocator(pLocator);
// pass a node to the parser :
_variant_t v;
v.vt = VT_DISPATCH;
v.pdispVal = pNode;
pNode->AddRef();
hr = pReader->parse(v);
The parser works (it directly goes to the specifed node),
but pLocator.CreateInstance fails (hr = -2147221164). What's wrong with it ?
JPG