Table of Contents

XPath Query

Description

The XPath Query calculation allows for querying data from XML documents using the XPath 1.0 specification.

Parameters

Options

Input Input Values
Root XPath Query Common XPath root query to a subset XML document that allows for easier querying by the output columns. (Required)
XML Column or Date Literal representing a valid XML document. (Required)
Only Rollup If Column or Date Literal

Output Columns

One to many XPath queries of the XML data produced by the Root XPath Query.

Input Input Values
XPath XPath query of the XML data produced by the Root XPath Query. This query can produce a single or multiple values. (Required)
Summarization None (Default), 'First value of the set', or 'Comma delimited string'
Output Processing None (Default), 'unescape XML' - If an XML node contains xml-escaped XML data, output valid XML data.

Remarks

This calculation uses the .NET Framework XML library's XPath implementation that follows the XPath 1.0 specification.

This calculation will produce a row for each returned node of an XPath query if the 'None' summarization is selected.

Example

Example 1

Consider the following document:

<books>  
    <book>  
        <title>Title</title>  
        <author>Author Name</author>  
        <price>5.50</price>  
    </book>  
    <book>  
        <title>Title 2</title>  
        <author>Author Name 2</author>  
        <price>10.50</price>  
    </book>
</books>  
  • Input:
    • Root XPath Query: /books
    • XML: above document
  • Output Grid Column1
    • Column 1
      • XPath: book/title/text()
      • Summarization: None
      • Output Processing: None

Output: |Column 1 | |---------| |Title| |Title 2|

Example 2

Consider the following document:

<books xmlns="http://www.contoso.com/books" xmlns:p="http://www.contoso.com/books/prices">  
    <book>  
        <title>Title</title>  
        <author>Author Name</author>  
        <p:price>5.50</p:price>  
    </book>  
    <book>  
        <title>Title 2</title>  
        <author>Author Name 2</author>  
        <p:price>10.50</p:price>  
    </book>
</books>  
  • Input:
    • Root XPath Query: /books
    • XML: above document
  • Output Grid Column1
    • Column 1
      • XPath: book/title/text()
      • Summarization: 'Comma delimited string'
      • Output Processing: None
    • Column 2
      • XPath: book/p:price/text()
      • Summarization: 'First value of set'
      • Output Processing: None
    • Column 3
      • XPath: book/author/text()
      • Summarization: 'None'
      • Output Processing: None

Output: |Column 1 |Column 2 |Column 3 | |---------|---------|---------| |Title, Title 2|5.50|Author Name| |Title, Title 2|5.50|Author Name 2|