Changes

Jump to navigation Jump to search
55 bytes added ,  03:41, 23 March 2012
''' Example: Find Countries '''
<codepre class="brush:xquery">//country</codepre>
tells BaseX to look for all <code>country</code> elements in the document. The query is introduced by two slashes <code>//</code>, which trigger the traversal of all document nodes. The queries {{Mono|//country}} andd {{Mono|/descendant::country}} will return the same results.
The following query uses a '''predicate''' <code>[...]</code> to filter all <code>country</code> nodes which have a <code>name</code> child, the string value of which is "Switzerland":
<codepre class="brush:xquery"> //country[name = "Switzerland"]</codepre>
To return all cities of the resulting element node, the query can be extended by a trailing <code>//city</code> path:
<codepre class="brush:xquery"> //country[name = "Switzerland"]//city</codepre>
== Visualizations ==
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu