Changes

Jump to navigation Jump to search
561 bytes added ,  07:31, 22 September 2011
== Querying ==
 
=== Keyword Search ===
 
The Keyword Search can be executed in the '''Search''' mode in
the combo box of the main window. This options allows for a simple,
keyword-based search in the opened database.
 
The following syntax is supported:
{| class="wikitable"
!Query
!Description
|-
|<code>foo</code>
|Find tags and texts containing <code>foo</code>
|-
|<code>=foo</code>
|Find exact matching text nodes
|-
|<code>@foo</code>
|Find attributes and attribute values
|-
|<code>@=foo</code>
|Find exact attribute values
|}
 
=== XPath/XQuery ===
Apart from the basic search facilities, BaseX offers far more sophisticated processing options to query your documents. Below are some examples you might give a try. This guide is far from being a comprehensive XQuery reference, but might point you in the right direction.
To execute the following queries, enter them in the XQuery Panel and hit press ENTER or click on the PLAY START button.
XPath provides an easy facility to query your documents in a navigational manner. It is the basic tool of all node-related operations that you encounter when using XQuery. We will start with a trivial example and extend it to our needs.
=== ''' Example: Find Countries ==='''
<code> //country</code>
As an example, <code>//country</code> is equivalent to <code>/descendant::country</code>.
=== ''' Example: Find Cities in Switzerland ==='''
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":
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu