Using xPath functions in XQL

Hi,

I’m having trouble using xPath functions. The manuele states “XPath 1.0 query” support, but I get an error when executing a query which contains a xpath function.

This works…
Var nodes As XmlNodeList
nodes = xml.XQL("/Export/publication/issue")

This doesn’t work…
Var nodes As XmlNodeList
nodes = xml.XQL(“count(/Export/publication/issue)”)

How can I fix this?

Thanks

tm

If that’s an exact cut-and-paste, then the first thing to do is change the smart quotes to dumb ones…

it is not the quotes … :slight_smile:

xml.XQL returns a xmlNodeList not an integer… If you want to find out how many nodes there that meet that xpath then get the XMLNodeList and use its Length property.

1 Like

I’m building a small app which allows users to enter a custom xPath expression. I can’t fix the missing functions by building a workaround if I don’t know what the xPath will be. Are xPath functions not supported? They are part of the xPath 1.0 spec. (https://www.w3.org/TR/1999/REC-xpath-19991116/)

Something like this …

You should wrap the XQL statement in Try/Catch/End and if there is an exception caught by the Catch you can display the raised error.

But it is important to note the the XQL returns a xmlNodeList… which you will need to parse to display in text.

Xojo XQL requires an “xpath query”… not an “xpath function”.