Interstage Shunsaku Data Manager Application Development Guide - Microsoft(R) Windows(R) 2000/ Microsoft(R) Windows Server(TM) 2003 - - UNIX - |
Contents
Index
![]() ![]() |
Appendix B Format of Search, Return and Sort Expressions | > B.3 Search Expressions |
Filter expressions are used to specify search conditions within the closed range of element nodes specified by the path expressions.
The definition format for filter expressions is shown below.
Example
An example search expression containing filter expressions is shown below.Document A
<root> <company> <employee position="manager"> <name>smith</name> <id>1000</id> <skill kind="0017">2005.1</skill> <skill kind="0023">2002.3</skill> <skill kind="0009">1998.8</skill> </employee> </company> <company> <employee position="chief"> <name>jones</name> <id>2000</id> <skill kind="0033">2004.7</skill> <skill kind="0012">2001.9</skill> </employee> </company> </root>
Document B
<root> <company> <employee position="chief"> <name>smith</name> <id>2000</id> <skill kind="0002">2003.2</skill> <skill kind="0010">2002.3</skill> </employee> </company> <company> <employee position="manager"> <name>jones</name> <id>3000</id> <skill kind="0001">1995.2</skill> </employee> </company> </root>Search Expression 1
/root/company/employee{/name = '^smith' AND /id = '1000'}Result
Document A matches the condition but Document B does not.Treat '/root/company/employee' as a single block. Document A contains data that matches the conditions in braces (/name = '^smith' AND /id = '1000'), while Document B does not.
Search Expression 2
/root/company/employee{/@position = '^manager' AND /id = '3000'}Result
Document B matches the condition but Document A does not.Search Expression 3
/root/company/employee/skill{/@kind = '^0001' AND /text() = '1995.2'}Result
Document B matches the condition but Document A does not.
Example
The following example shows the search expression that a filter expression contains text expressions.
/root/company/employee/skill{/text() = '1995.2' AND /@kind = '0001'}
Evaluates to TRUE if the value of the text node in the element node represented by '/root/company/employee/skill' is '1995.2' and the value of the attribute node is '0001'.
Example
In the following example, an error will occur because '*' is specified as the final path element of the path expression.
/root//company/*{/name = '^smith' AND /id = '1000'}
Contents
Index
![]() ![]() |