Skip to main content
Version: 5.3

XML Read Data

XML documents as source

As a transfer source, the XML object extracts content from XML code based on the configured X-Path queries.

  • The XML code is either set statically at design time or submit at run time to the element “XML”.
  • The results are read from the X-Path query elements.

For example, the following code is supplied from a file:

<?xml version="1.0"?>
<catalog>
<book id="bk101">
<author>J.R.R. Tolkien</author>
<title>The Hobbit</title>
</book>
<book id="bk102">
<author>Joanne K. Rowling</author>
<title>Harry Potter and the Philosopher's Stone</title>
</book>
</catalog>

Then two X-Path expressions would supply the author and title of the books:

  • Name: “Author”, X-Path expression “/catalog/book/author”
  • Name: “Title”, X-Path expression “/catalog/book/title”

On the Internet you will find different documentations about the possibilities of X-Path, these are just the simplest (Restriction: Any nodes must be initiated with “//”).

For this example, the configuration looks like this:

  • The path and name of the file are transferred from a constant object to the file transfer object. The name could also be determined dynamically from a database.
  • The file transfer object transfers the contents of the XML file to the XML element in the XML object. At design time no code was deposited here, only the two described X-Path expressions.
  • The query results are written to an Excel file. Every other data destination is just conceivable (e.g. database INSERTS). Since several lines are expected, the write mode is “attache rows” in the Excel object.