Searching Multi-value Properties

Searching of multi-value properties with XPath is supported by mapping multi-value properties to XML attributes of the list type and employing the XPath feature of general comparisons.

XML Schema supports attributes having types. Among those is one called the list type7. This type specifies that white space within an attribute value serves as the delimiter between individual list items.

Additionally, XPath distinguishes between two types of comparison operators: general comparisons (=, !=, <, >, <= and >=) and value comparisons (eq, ne, lt, le, gt, and ge). General comparisons, when applied to a list type attribute value, will return true if the specified relation (equal, not equal, greater-than, etc.) evaluates to true for at least one of the values of in the list. Value comparisons test the entire attribute value as a single unit. In cases where an attribute only has one value, the general and value comparisons are identical.

In the virtual XML document against which XPath queries are run, multi-value properties will be mapped to XML attributes with values in a form similar to the XML list type.

However, since the XML document is virtual, it need never be actually serialized. As a result, we do not need to specify white space as the delimiter. Doing so would require that white space that occurs within a value of a multi-value property be escaped when converted to document view, which would in turn require use of awkward escaping characters within XPath queries that tested for such values.

Instead, we simply specify that tests against multi-value properties using general comparison operators act as they would if the multi-value property were a list type attribute, except that spaces within individual values used within the test are not escaped. For example:

/x/y[@p = 'hello']

would return all nodes with path /x/y that have a property p which has at least one value "hello".

Note that multi-value properties in document view will be handled differently for purposes of export (see 6.4.2 Document View XML Mapping).