You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by um...@gslab.com on 2008/05/29 20:19:04 UTC

Return type of the xpath query during the compilation of xpath

Hi ,
    I want to know is there any way in xalan xpath to come to know the
return type of the xpath query. I know that there is a way to determine
the return type of the  xpath query after evaluation but for my purpose
I want to know this return type at compilation time .
    If there is no way then can any one point to me how it can be done.

Thanks.
Regards,
Umesh


Re: Return type of the xpath query during the compilation of xpath

Posted by David Bertoni <db...@apache.org>.
umeshc@gslab.com wrote:
> Hi ,
>     I want to know is there any way in xalan xpath to come to know the
> return type of the xpath query. I know that there is a way to determine
> the return type of the  xpath query after evaluation but for my purpose
> I want to know this return type at compilation time .
I don't believe this functionality exists.

>     If there is no way then can any one point to me how it can be done.
You would need to step through the XPathExpression until you reached the 
terminal subexpression and analyze it to see what type it returns. 
There are some hints in the enum eOpCode in XPathExpression.h as to the 
return type of each opcode.  In some cases, it will require some special 
code, because functions which are not compiled into the op code map will 
need to be mapped to the return type specified by the XPath 1.0 
recommendation.  For an example of iterating through the opcode map, 
take a look at XPath::doGetMatchScore() in XPath.cpp.


Unfortunately, if there are user-supplied functions, there's no way to 
tell what they might return.  But perhaps you don't care about that.

This would be nice functionality to have in the core code, so please 
consider contributing it back, if you can.  You can post any questions 
you might have and I'll try to respond to them as best I can.

Dave