8.1. The "Create or edit an advanced query" dialog box

The "Search Files" tool is not limited to simple text searches. You can use it to perform more elaborate searches. For example: find all documents containing an element whose id attribute starts with "topic":

In the above screenshot, notice the query being used: "@id =~ ^topic". The syntax of this query is easy to remember. However, fortunately, you don't even need to do this effort. Suffice to click on "Create or edit an advanced query" to display a query editor dialog box.

Figure 7.6. The "Create or edit an advanced query" dialog box
The "Create or edit an advanced query" dialog box

Description of the text fields and comboboxes from top to bottom and left to right:

Text field "Parent elements match:"

Specifies the parent element and also possibly the ancestors of the subject of the search.

An empty "Parent elements match:" text field means: whatever the parent or ancestors.

Subject type combobox

Specifies the node type of the subject of the search: element, attribute, processing-instruction or comment.

Subject name text field

Specifies the name of the subject of the search when this subject is an element or attribute. Specifies the target of a processing-instruction when the subject of the search is a processing-instruction.

  • A non-qualified name such as "para" matches any name having "para" as its local part . That is, the namespace and the prefix of a name are not considered.

  • A qualified name such as "db:para" matches any name having "db" as its prefix and "para" as its local part. The namespace of a name is not considered.

  • A name specified using Clark's notation such as "{http://docbook.org/ns/docbook}para" matches any name have "http://docbook.org/ns/docbook" as its namespace and "para" as its local part. The prefix of a name is not considered.

    Use "{}" to specify the absence of namespace. Example: "{}para".

  • In a name specification, an "*" wildcard may be used in the local part, the prefix or the namespace. Examples: "db:*", "*:para", "{*}para".

An empty subject name text field means: whatever the name of the element or attribute or whatever the target of the processing-instruction.

Match operation combobox

Specifies how the textual content of the subject is matched with the searched value:

  • the textual content contains the searched value,

  • OR the textual content is equal to the searched value,

  • OR the textual content contains a substring matching the searched value, which is a regular expression.

All these operations are case-insensitive.

Searched value

Specifies the searched value, some plain text or a regular expression, depending on the chosen the match operation. The text search is case-insensitive.

The supported syntax for regular expressions is documented here.

An empty searched value text field means: whatever the textual content of the subject.

Examples:

  • Find documents containing literal elements containing a text equal to "XXE": Element name matches: literal; Searched value: XXE.

  • Find documents containing table elements having an xml:id attribute: Parent elements match: table; Attribute name matches: xml:id.

  • Find documents containing comments: simply select "Comment" in the Subject type combobox.

  • Find documents containing the <?xxe-relaxng-schema> processing-instruction: PI target equals: xxe-relaxng-schema.

  • Find documents containing absolute HTML links: Parent elements match: a; Attribute name matches: href; Containing substring matching regular expression: ^http://.