Understanding XPath Expressions
A fundamental thing when building a report based on XML data is to understand some basics about XPath. XPath is a syntax used to describe parts of an XML document and you can think of it as a path to the data you want. You can refer to a set of nodes such as all the rooms in the document, a specific attribute like the room name attribute in the room and many other variants.
XF Designer will help you create most of these expressions for you, but it is recommended to get some understanding of this. In some of the more advanced reports/tasks you might also need to edit some expressions manually.
When you refer to multiple nodes you refer to a node set. In the example image to the right the expression
refers to all the room nodes under the room-container node, in this case two rooms. You use this kind of XPath expression when you want to do something for each room in the XML. If you want to get a specific attribute value, such as the value of the project name attribute, you can use
There are also functions that you can use to make tests or other operations, e.g. sum, count etc: The expression
returns the number of rooms in this document, 2. |