Find Structures Documents
Selecting document elements
The Document Structure finder can locate pieces of information within a document using queries that can detect elements via their physical location and/or the data they contain. You enter the search query into the field shown below, then click Search to select document elements that match the query.
A query is made up of one or more instructions. The query shown above works by first finding (FIND) the document element containing the text "column", shifting-down (SHIFT-DOWN) to the next table, then finally excluding any further selections (EXCLUDE-DOWN) in the document. Clicking Search shows the selection found by the system, outlined in orange below.
The remainder of this topic explores types of instructions and attributes.
- Searches are case insensitive.
- The document tree of document elements starts at index zero (0), which is the document's first element.
- Searches for text resolve to matches on whole words only.
- Any syntax description that contains square braces ("[" and "]") identifies optional parameters.
- References to text should be in double quotes ("and").

Instruction: FIND
Syntax
FIND: document-element-query[, textblock-query] (see below).
The "FIND" instruction will find any elements that match the path and whose text block matches text. If path is given, then found text blocks are expanded to the last explicit path element.
Repeated "FIND" instructions will add to the set of found elements.
Examples
FIND: root any
Selects any element directly under the root.
FIND: root table
Select all tables directly under the root level.
FIND: root table, "navy"
Select all tables directly under the root level that contain a textblock with the text "navy".
FIND: table
Selects all the top most tables in the document (no nested tables).
FIND: table any
Selects any element which is directly under all the topmost tables in the document.
FIND: text
Selects all the text blocks in the document.
FIND: table text
This will not find any structures as textblock are not directly under a table (table -> row -> cell -> textblocks).
FIND: table any any text
Selects texblocks under the children of children of all the topmost tables.
FIND: table row
Selects all the rows in the topmost tables of the document.
FIND: table cell
Will not select anything as cell is not a child of the table. A cell is always a child of a row.
FIND: table 1
Selects the first child of all the topmost tables.
FIND: table row 2
Selects the second child of the all the rows in all the topmost tables.
FIND: table row-1 2
Selects the second child of a row which is the first child of the topmost tables.
FIND: [elem=Attachment]
Selects the top most element which has the feature elem= Attachment.
FIND: table [elem=Attachment]
Selects all topmost tables which have the feature elem=Attachment.
FIND: *
When * is not preceded by any element, it will find the bottom most element.
eg: find: table * - Will find the bottommost elements in all the topmost tables.
Since * finds the bottommost element, adding two or more stars will not change the result.
FIND: * cell
Selects the bottommost cells in the whole document.
FIND: root 7
Selects the 7th document element directly under the root.
FIND: table-45
Select all tables that are the 45th child of any parent element ("root" or otherwise).

Attribute: document-element-query
table-3
Refers to a document element of type "table" which is the 3rd child of a parent document element.
table
Refers to a document element of type "table" which has an unspecified child index of a parent document element.
9
Refers to any document element which is the 9th child of a root.

Attribute: textblock-query
"navy" "air"
Select either "navy" or "air".
+"navy" +"air"
Select both "navy" and "air".
+"navy" -"air"
Select "navy" but not "air".

Instruction: EXPAND
Syntax
EXPAND: [document-element-query]
Takes all currently-found document elements and for each, goes up in the document tree until a matching document element type is found. The set of currently-found document elements is replaced with new elements, as described in the example below.
Example
FIND: *, "navy"
Selects any textblocks that contain a textblock with the text "navy".
EXPAND: table
For all textblocks found above, the table they're in will be found. If any textblock was not in a table it will no longer be selected. Only document elements of type "table" are selected from this point.
Since this instruction "EXPAND" does not find itself, multiple "EXPAND: table" will always go up in the document tree to find parent tables encompassing the current table.

Instruction: SHIFT-UP/DOWN
Syntax
SHIFT-UP: document-element-query[, textblock-query]
SHIFT-DOWN: document-element-query[, textblock-query]
For each currently-selected document element, this instruction "SHIFT-UP/DOWN" will find a new document element that matches the new query and is above/below (that is, before/after, respectively) in the document relative to the current selection. The newly found document element will replace the originally-found document element.
Example
FIND: section, "army movements"
Selects any document elements of type "section" containing a textblock with the text "army movements".
SHIFT-DOWN: table
Selects the next occurrence of a document element of type "table".

Instruction: FILTER
Syntax
FILTER: document-element-query[, textblock-query]
This instruction "FILTER" only retains document elements that match the filter.
Example
FIND: table, "army"
Selects any document element of type "table" containing a textblock with the text "army".
FILTER: table, "infantry"
Removes from the selection any tables that do not contain a textblock with the text "infantry".

Instruction: Exclude
Syntax
EXCLUDE: document-element-query[, textblock-query]
Removes document elements that match the query from the current selection.
Example
FIND: table, "army"
Selects any document element of type "table" containing a textblock with the text "army".
EXCLUDE: table, "tanks"
Removes from the selection tables that contains a textblock with the text "tanks".

Instruction: FIND-WITHIN
Syntax
FIND-WITHIN: document-element-query[, textblock-query]
Executes a search but only selects document elements within the children and descendants of the current selection. For example, a row in a table is a child. Each of the cells in the row are descendants.
Example
FIND: table, "army"
Selects any document element of type "table" containing a textblock with the text "army".
FIND-WITHIN: row
Selects any row within the currently matching table.

Instruction: FIND-PREV/NEXT
Syntax
FIND-PREV: document-element-query[, textblock-query]
FIND-NEXT: document-element-query[, textblock-query]
Executes a search but only selects the first matching document element above or below the current selection.
Example
FIND: heading, "Heading 1"
Selects any document element of type "heading" containing a textblock with the text "Heading 1".
FIND-NEXT: table
Selects the first document element of type "table" that appears under the above heading.

Instruction: FIND-UP/DOWN
Syntax
FIND-UP: document-element-query[, textblock-query]
FIND-DOWN: document-element-query[, textblock-query]
Executes a search but only selects document elements above or below the current selection.
Example
FIND: heading, "Heading 1"
Selects any document element of type "heading" containing a textblock with the text "Heading 1".
FIND-DOWN: table
Selects all document elements of type "table" that appear under the above heading.

Instruction: EXCLUDE-UP/DOWN
Syntax
EXCLUDE-UP: document-element-query[, textblock-query]
EXCLUDE-DOWN: document-element-query[, textblock-query]
Removes any selection above or below the found document element.
Example
FIND: heading, "Heading 1"
Selects any document element of type "heading" containing the text "Heading 1".
FIND-DOWN: table
Selects any document elements of type "table" that appear below the above heading.
EXCLUDE-DOWN: heading, "Heading 2"
Removes from the selection any selected document elements that appear below any document element of type "heading" that contains a textblock with the text "Heading 2". This would result in a selection that only selects tables between "Heading 1" and Heading 2".