Textflo - XPath Search Example

This page gives one example of using the application to search for a particular XML field that meets certain conditions. This is only an illustrative example using the XML-based menu document. The example makes use of both the general text search and the query search form, for a numerical comparison.

It is possible to search through specific XML paths to try and find certain elements that contain certain information. The application can filter text in a way that is similar to what an XPath query would do. You can specify the element tag names in the path to look for and then filter them accordingly, until only the relevant ones remain. In this example, based on the menu document, a user is searching for food related to waffles that is less than $6.00 in price. Note that there could be different ways to do this, but this example illustrates a number of simple features that allow an XML document to be traversed manually.

The first step is to find all of the food item elements, or all elements with the 'name' tag. One option would be to use the toolbar search, to enter a text value and then click the Search <X> button to match with element tag names. We only want the waffle foods and so the toolbar search could then find lines that 'contain' the word 'waffle' in it. The second search can be carried out of the highlighted lines only and so it will select from the 'name' elements only.

Now only three named items are selected. There is a toolbar button to move all of the selected lines down one line, automatically. This is the red and black connected lines button. Clicking this results in the following lines being selected:

The search now needs to include only items that cost less than $6.00. The query form can be used to execute a numerical query. This results in one remaining line, as shown below:

Finally, the user might move to the next element in this path, which is the description element. As only one is selected, this would describe the desired food item. So this is something similar to asking a query to find the XML path 'name/price/description' with the conditions that the name value must contain 'waffles' and the price value must be less than $6.00.