locked
XPath Query for Healthvault - escaping special characters RRS feed

  • Question

  • Hi,

    I am trying to do XPath query on data in health vault using following:

    /thing/data-xml/health-event/event/code/value[contains(lower-case(.), lower-case("search this *"))]

    I have tried escaping the * but always get back the following error:

    "The filter contains an XPath clause that contains recursive directives. Only simple relative or absolute paths are allowed. Most XPath filters should start with '/thing/data-xml' followed by the type specific information you are looking for"

    This is the search query coming from the user so I don't want to remove characters only escape. Is there a way I can escape these characters?

    Tuesday, July 8, 2014 5:26 PM

Answers

  • Hi Sumit,

    ‘*’ is a character we don’t allow to be specified in the transform along with ‘//’, ‘descendant::’, and ‘descendant-or-self::’ . You should be able to use the contains function to get the “search this” regardless of where it is in the source string without needing to use the ‘*’.  You may also try the the starts-with function if the string you are searching for happens to be at the begging of the source string.

    -Sean

    Friday, July 18, 2014 7:27 PM

All replies

  • Hi Sumit,

    ‘*’ is a character we don’t allow to be specified in the transform along with ‘//’, ‘descendant::’, and ‘descendant-or-self::’ . You should be able to use the contains function to get the “search this” regardless of where it is in the source string without needing to use the ‘*’.  You may also try the the starts-with function if the string you are searching for happens to be at the begging of the source string.

    -Sean

    Friday, July 18, 2014 7:27 PM
  • Thanks for the reply Sean. I am not using * as a wild card search character. It is a user input searching for '*' in one of the things in health vault. It will be nice if there is a way to escape it on my end so that I can search the character '*' itself.

    -Sumit

    Tuesday, July 22, 2014 2:43 PM