Re: [xml] Return type of the xpath query during the compilation of xpath

Daniel Veillard wrote:
On Thu, May 29, 2008 at 09:57:06AM +0530, Umesh Chandak wrote:
Hi ,
I want to know is there any way in libxml 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 point to me how it can be done in libxml xpath.

  There is no way in libxml2, we didn't try to provide this informations.
I also don't think it's possible in all cases since XPath alllows the
support for vairables. See the introduction of the spec:

 "The value of a variable is an object, which can be of any of the types
  that are possible for the value of an expression, and may also be of
  additional types not specified here."

  "$foo" is a correct XPath expression, you can't determine its type
statically at compile time since variable definitions are available only
during evaluation.

  Without variable this is probably possible, nobody asked for it so far,
and this is not present in libxml2.


Thanks for the reply. Can you provide me some pointers for how I can do this without the variable in xpath. Basically I want to determine the return type of xpath query is boolean, string , number or nodeset without the variable in xpath queries.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]