Interstage Shunsaku Data Manager Application Development Guide - Microsoft(R) Windows(R) 2000/ Microsoft(R) Windows Server(TM) 2003 - - UNIX - |
Contents
Index
![]() ![]() |
Part 1 The Basic for Developing Application | > Chapter 3 Data Search Methods | > 3.6 Extracting Search Results |
It is possible to specify a text expression in the return expression to extract data under any node of an XML document or the data under the attribute nodes of that element node in text format.
It is also possible to include a single-line function specification in the return expression. When a single-line function specification is used, the results of the rlen function or the val function can be extracted in text format.
Refer to B.2.4 Single-line Function Specification for more information on single-line function specifications.
The explanations accompanying the following examples assume that the following single XML document has been found using a search expression.
<doc> <employee eno="19980120" position="general manager"> <name>Sara Jones</name> <department sno="1001">Development Dep.</department> <phone>2201-1101</phone> <email>sara.jones@shunsaku.fujitsu.com.au</email> </employee> <basic date="2006/02/16" expense="$72.00"> </basic> <detail> <destination area="Clearview, Belair, Adelaide">Head Office</destination> <purpose>Regular project meeting</purpose> <train>$66.00</train> <taxi>$6.00</taxi> <hotel></hotel> <comment>None</comment> </detail> <report>Must create and report a sales results chart by next meeting</report> </doc> |
Example 1
The following example shows how to extract a trip report (report):
/doc/report/text()Result
Must create and report a sales results chart by next meeting
Example 2
The following example shows how to extract a trip are (are):
/doc/detail/destination/@areaResult
Clearview, Belair, Adelaide
Example 3
The following example shows how to extract numeric values from trip expenses (expense):
val(/doc/basic/@expense)Result
72.00
More than one return parameter can be specified in the return expression. Each return parameter must be separated with a comma. If multiple return parameters are specified, the values of the results returned by those parameters are separated with a delimiter.
Example 4
The following example shows how to extract the employee number (eno), the employee name (name), the trip date (date) and the trip purpose (purpose):
/doc/employee/@eno,/doc/employee/name/text(),/doc/basic/@date,/doc/detail/purpose/text()Result: When the Java APIs are used
19980120,Sara Jones,2006/02/16,Regular project meetingResult: When the .NET APIs are used
19980120 \1 Sara Jones \1 2006/02/16 \1 Regular project meetingResult: When the C APIs are used
19980120 \1 Sara Jones \1 2006/02/16 \1 Regular project meeting \1
Example 5
The following example shows how to extract the employee number (eno), the section number (sno), the trip date (date) and the trip purpose (purpose):
/doc/employee/@eno,/doc/employee/department/@sno,/doc/basic/@dateResult: When the Java APIs are used
19980120,1001,2006/02/16Result: When the .NET APIs are used
19980120 \1 1001 \1 2006/02/16Result: When the C APIs are used
19980120 \1 1001 \1 2006/02/16 \1
When a sort expression is specified, the search results will be returned in the order determined by the sort expression.
When multiple return parameters are specified, all return parameters must be specified as either text expressions or single-line function specifications. They cannot be specified together with a path expression (result returns in XML format).
Contents
Index
![]() ![]() |