Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. The more details you provide, the better.
    In our case, library/books/book[1] and //book[1] are equivalent, but the first one is faster because it does not have to look for book elements inside of manager and owner nodes.
    A more detailed filter also helps to avoid mistakes. If you want to exclude firstname from all author elements and use //firstname as a Filter, manager and owner nodes will also lose their firstname, which may be unwanted.See https://tornado.umbrellanet.ch/jira/browse/UF-6368

  2. Use starts-with() over contains() when you expect the substring to be at the beginning.
    //books/book[starts-with(title, "A Game")] will give up on "A Tale of Two Cities" as soon as it reaches the character "T". //books/book[contains(title, "A Game")] will search the entire string through which is bad for performance. It also can lead to unwanted elements being filtered.See https://tornado.umbrellanet.ch/jira/browse/UF-6094.

  3. Avoid using the | operator. Better create two separate filters to improve readability and simplify debugging.

...