You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Sanjoy Ghosh <sa...@yahoo.com> on 2004/10/26 20:06:57 UTC

XPathEvaluator throws unknown exception

Hello,

I am using the following code to evaluate a vector of XPath strings against a context node:

 XalanSourceTreeDOMSupport& getDOMSupport () {return *_domSupport;}
 XalanDocumentPrefixResolver& getPrefixResolver () {return *_prefixResolver;}
 XPathEvaluator& getXPathEvaluator () {return *_xpathEvaluator;}


void FpMLWalker::processPositionNode (XalanNode* node) {
 int count = 0;
 vector<XPathItem>::iterator xpathIterator;
 for (xpathIterator = _xpathItems.begin(); xpathIterator != _xpathItems.end(); xpathIterator++) {
  try {
   cout << count++ << "  " << xpathIterator->getXPath() << "  ";
   XalanNode* xpathNode = getXPathEvaluator().selectSingleNode( getDOMSupport(), node, 
     XalanDOMString( xpathIterator->getXPath().c_str()).c_str(), getPrefixResolver());
   if (xpathNode != NULL) {
    if (xpathNode->getFirstChild() != NULL)
     cout << xpathNode->getFirstChild()->getNodeValue() << endl;
    else
     cout << xpathNode->getNodeValue() << endl;
   }
   else
    cout << "No Result" << endl;
  }
  catch (...) {cout << "WHAT" << endl;}
 }
 cout << endl;

}


This function is called with a series of context nodes which have the same structure and the same namespace and element tag.  The XPath expressions are also the same.  But after the first few calls, it throws some exception which is caught by catch (...).  After that it always throws an exception and is never able to recover.

How do I find out who is throwing the exception, and what exception is being thrown?  I couldn't find any "throws" clause in the API.  The XPathCApi also catches a generic exception.  Is there any way to find out who is throwing the exception, and why?  And is there a fix for this :)

Thanks,

Sanjoy