Skip to main content

Module xpath

Module xpath 

Source
Expand description

The query language that a resolver uses.

liblsl runs the query through pugixml and asks for a boolean (src/stream_info_impl.cpp:214). That is XPath 1.0, evaluated with the <info> element of the stream as the context node.

Most queries come from resolver_impl::build_query, which only ever writes session_id='X' and prop='Y' (src/resolver_impl.cpp:66-73). An application that calls lsl_resolve_bypred supplies its own text, and liblsl joins it to the session test with and. That text can be any XPath expression, so a resolver that reads only equality hides streams that ought to match.

§What this reads

oracle/xpath.py sends a battery of queries to a real outlet and records the answers. That battery is the specification for this module, and every shape in it is read here:

  • and, or, not(), parentheses
  • =, !=, <, >, <=, >=
  • +, -, *, div, mod, and a leading minus
  • contains, starts-with, substring, string-length, translate, concat, normalize-space, string, number, floor, ceiling, round, count, true, false, not
  • a child element by name, a path of names, and //name for a descendant

§What this does not read

Attributes, predicates in brackets, axes written in full, variables, and the union operator. None of them appears in a description, which holds elements and text and nothing else. An expression that uses one fails to parse, and a query that fails to parse matches nothing. liblsl does the same for an expression that pugixml refuses: it catches the error, writes a warning, and reports no match (src/stream_info_impl.cpp:239-241).

Functions§

matches
Test one description against one query.