Examples: XPath text search

All valid XPath queries that are sent to the XML parser must be written in a subset of the XPath language using opaque terms. Opaque terms are not parsed by the linguistic text search parser.

The text search parser recognizes an opaque term by the syntax that is used in the text search. For example:
@xpath:'query' 
where query is the text shown in the examples in the following table.
Table 1. Examples of valid XPath queries
Query Description
/sentences Any document with a top-level tag called sentences.
//sentences Any document with a tag at any level called sentences.
/sentence/paragraph Any document with a top-level tag sentence having a direct child tag paragraph.
/sentence/paragraph/ Any document with a top-level tag sentence having a direct child tag paragraph.
/book/@author Any document with a top-level book tag having an attribute author.
/book//@author Any document with a top-level book tag having a descendant tag at any level with the attribute author.

/book[@author contains("barnes")
and @title = "the lemon table"]

Any document with a top-level book tag with an author attribute containing "barnes" (normalized) and a title attribute that only contains the words "the," "lemon" and "table" (normalized in that order).

/book[@author  
contains("barnes") and (@title  
contains("lemon") or @title  
contains("flaubert"))]  

Any document with a top-level book tag with the specified author attribute and either of the two specified title attributes.
Start of change/book[@publishDate > xs:date("2000-01-01")]End of change Start of changeTop level tag is book and book has an attribute PublishDate that is greater than the date of 2000-01-01.End of change
Start of change/book[purchaseTime > xs:dateTime("2009-05-20T13:00:00")]End of change Start of changeTop level tag is book. book has a direct child purchaseTime that is a DateTime expression greater than 2009-05-20T13:00:00.End of change

/program[. contains("""hello,
world.""")  

Any document with a top-level program tag containing both the tokens hello and world (normalized) in that order and in consecutive positions.

/book[paragraph  
contains("foo")]//sentence

Any document with a top-level book tag with a direct child tag paragraph containing "foo" and, referring to the book tag, having a descendant tag sentence at any level.
/auto[@price < 30000.] Any document with a top-level auto tag having an attribute price with a numeric value that is less than 30000.
//microbe[@size < 3.0e-06] Any document containing a microbe tag at any level with a size attribute with a value that is less than .000003.