Skip to main content

Query XML data with Powershell in TimeXtender Orchestration and Data Quality


Christian Hauggaard
Community Manager
Forum|alt.badge.img+5

In this article, you will learn how to query XML data with Powershell in TimeXtender Data Quality. This can, for example, be used to monitor changes in files, find suspect nodes or compare against another data source.

In this example, we will use data from books.xml, a list of books with attributes where we will find all books priced higher than $10.00

<?xml version="1.0"?>
<catalog>
   <book id="bk101">
      <author>Gambardella, Matthew</author>
      <title>XML Developer's Guide</title>
      <genre>Computer</genre>
      <price>44.95</price>
      <publish_date>2000-10-01</publish_date>
      <description>An in-depth look at creating applications 
      with XML.</description>
   </book>
   <book id="bk102">
      <author>Ralls, Kim</author>
      <title>Midnight Rain</title>
      <genre>Fantasy</genre>
      <price>5.95</price>
      <publish_date>2000-12-16</publish_date>
      <description>A former architect battles corporate zombies, 
      an evil sorceress, and her own childhood to become queen 
      of the world.</description>
   </book>
   ... more books ...
</catalog>

Follow these steps to create the query

  1. Create a Query in TimeXtender Data Quality
  2. Choose "PowerShell" as a Data Provider
  3. Enter the following PowerShell script
    [xml]$xml = Get-Content "C:\temp\books.xml"
    
    $xml.SelectNodes('/catalog/book') | where {[decimal]$_.price -gt 10 } | select id, author, title, price
  4. Configure email settings and schedule as normally

Example output from the test:

 

Did this topic help you find an answer to your question?

0 replies

Be the first to reply!

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings