XPath Expressions
XPath is a query language for XML, which models XML as a tree of nodes. There are seven kinds of nodes: element, attribute, text, namespace, processing-instruction, comment and root node (the topmost element of the tree).
XPath (standing for XML Path Language) uses path expressions to select nodes or node-sets from XML documents. On the other hand, XPath also contains 200+ built-in functions and operators which, in combination with path expressions, are used to build XPath expressions. An XPath expression returns either a node-set, a string, a boolean, or a number.
On top of the built-in functions, Docentric added custom functions for additional data extraction and manipulation. Some of them also return a date-time or special characters such as carriage return or new line.
Learn more about XPath expressions consisting of:
Learn more about XPath on W3Schools >>
XPath Editor in Docentric Designer
Docentric Designer uses XPath expressions to bind Tagging Elements to data from the XML-based report data source (DDSP – Docentric Data Source Package), when designing a report template. For example, a LIST or GROUP Tagging Elements are bound to an XPath expression returning a node-set while a FIELD Tagging Element is bound to an XPath expression returning an atomic value: a string, a boolean, a number or a date-time (returned by Docentric custom XPath functions).
Docentric Designer’s Binding Control for Tagging Elements used in a report template allows you to create XPath expressions automatically by clicking the wanted data records or fields (i.e. XML elements and attributes).
When you want to achieve advanced scenarios, such as binding a LIST Tagging Element to a filtered collection of data records (i.e. XML elements) in the report data source or binding an IF Tagging Element to an arbitrary boolean expression based on different data in the data source, you need to create XPath expressions manually.
XPath Editor in Docentric Designer offers you a reference list of XPath operators and functions (both standard and Docentric custom) that you can use when creating XPath expressions manually. By clicking an operator or a function in the reference list within the editor, its snippet will appear in the XPath scripting area, while path expressions for selecting and filtering nodes including predicates (e.g. SalesInvoiceLines[@LineAmount > 5000]) you need to enter manually.
Check out video tutorials on Docentric Designer >>
XPath Expression designer in User-defined placeholder setup in D365FO
User-defined placeholders uses XPath expressions to bind a placeholder definition to data from the XML-based report data source (DDSP – Docentric Data Source Package). These XPath expressions are configured in Expression designer in User-defined placeholder setup in D365FO, and they are calculated in the report runtime.
Since User-defined placeholders currently supports only atomic values, their XPath expressions should return a string, a boolean, a number or a date-time (returned by Docentric custom functions).
User-defined placeholders can be used in both print destination and Docentric report setup settings. Learn more >>