Thanks for the reply!
The node is selected - it exsists, but the "evaluate" later on is the
function I ask about, It returns the XObjectPtr, which is not null but
still has no data...

The xml is as simple as:
<Node>
  <Son>SonVal</Son>
</Node>

And I select Node, and the query Son's value - and need to know is it
there or not.

Thanks again,
Alice

> Hi,
>
> According to the documentation:
>
> XPathEvaluator::selectSingleNode  will not throw an exception, but return
> 0 if no nodes are selected.
>
> From the documentation
> (http://xml.apache.org/xalan-c/apidocs/classXPathEvaluator.html#a2):
>
> "If the expression doesn't select a node, 0 is returned. If it selects
> more than one node, only the first is returned."
>
> -Matt.
>
>
>
>
>
>
>
>
>
> [EMAIL PROTECTED]
> 09/29/2004 03:37 AM
> Please respond to
> xalan-c-users
>
>
> To
> [email protected]
> cc
>
> Subject
> what should happen when path does not exsist
>
>
>
>
>
>
> Hi all.
>
> I have a bit of simple code using xalan to get a certain node value, but
> in the case the node does not exsist I expect it to throw an exception,
> which doesn't happen.
> This is a segment of the code:
>
>
> ....
> try
>                  {
>                                  // OK, let's find the context node...
>                                  XalanNode* const theContextNode =
>  theEvaluator.selectSingleNode(
>                                                  theDOMSupport,
>                                                  &docWrapper,
>  XalanDOMString(szContext).c_str(), prefixResolver
>                                                  );
>
>                                  if (theContextNode)
>                                  {
>                                                  // OK, let's evaluate the
> expression...
>                                                  const XObjectPtr
> theResult(
>  theEvaluator.evaluate(
>  theDOMSupport,
>  theContextNode,
>  XalanDOMString(xpathXpr).c_str(),
>  prefixResolver
>                                                                  ));
>                                                  if(!theResult.null()){
>                              return theResult;
>                                                  }
>                                  }
>                  }
>                  catch(...)
>                  {
>           // doesn't get here...
>                  }
>
> ...
>
> When I use ->str on the result object I get an empty string.
> How can I know the path does not exist?
>
> Thanks alot.
> Alice.
>
>
>


Reply via email to