![]() declare namespace x='' for $node in doc("address.xml")//x:Placemark where = 'p1' return concat( $node/address/text(), " is located at ", $node/Point/coordinates/text() ) `_result' has value `7455 132 St, Surrey, BC, Canada is located at -122.856695,49.137818,0' The XML source may also be specified in the query using the 'doc("file.xml")' function. XQuery also supports more complex operations using the 'for', 'let', 'where', 'order by', and 'return' keywords. ![]() In all of the above examples, the query has been a simple XPath expression. To retrieve the value of an attribute, use the following syntax: declare namespace x='' `_result' has value `p1' Seven features are returned, containing as the result the values of the kml, Response, name, Placemark, address, Point, and coordinates nodes. The following query will match all nodes: //* Similarly, the depth of the query can be specified using the wildcard '*': /*/*/*/*/* `_result' has value `-122.856695,49.137818,0'Īn XPath expression beginning with '//' will specify that the search start from any node that matches the element that directly follows. ![]() The XPath expression below will return the full XML string regardless of namespace: /* If the top-level node had no namespace attribute (that is, ''), then the following XPath expression would produce the same result: /kml Since the top-level node contains the namespace declaration 'xmlns', the namespace must be declared in the query and it must be used to specify every element.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |