Skip to main content

xSuite Interface Windows Prism 5.x – Online Help

Index Data Reader "Xml"

The "Xml" index data reader is a generic index data reader for XML files with structure that is largely arbitrary.

Property

Description

ProcessReadIndex[].ItemNode[]

Subparameters for defining an XML node that contains subelements, each representing a row of tabular data:

  1. ItemNode: node in question in XPath syntax

  2. FieldName: table name of the target fields in the field catalog (optional)

The .ItemNode[] property can be defined multiple times with different FieldName parameters if there are multiple XML nodes whose values are to be assigned to different target tables. If the parameter is omitted, the entry will apply globally to all tables.

Specify the path to the source node in the field mappings under ProcessReadIndex[].Field[].InputName. For tabular data, define this path relative to the node determined via the ItemNode parameter.

ProcessReadIndex[].RemoveXmlNs

Boolean value determining whether namespace information contained in XML files will be removed from them before parsing, to avoid related parsing problems

If need be, XPath expression for referencing nodes are then to be specified without the namespace prefix.

Default value: TRUE

Caution

If namespaces are retained, XML documents are not readable if they use a standard namespace (without a prefix), e.g., for the root node.

For the definition of the path of an XML node to be read in the .InputName property, use the XPath syntax (XML Path Language) Version 1.0. (A detailed description of the XPath syntax can be found, for example, at https://www.w3.org/TR/xpath/.)

Short summary of XPath syntax:

  • The individual XML nodes in the path are separated from each other by /.

  • Attributes are marked with a preceding @.

  • A filter expression [...] can be applied to nodes in order to select only those with certain attributes or text contents.

  • The XPath expression can be prepended with the selectors / and //. With both selectors, the search starts at the root node, but with / only direct child nodes are found. With //, also more distant child nodes will be found without formulation of the complete path to them. Without these selectors, depending on the context, the search starts at the current node if it is a different one than the root node.

  • The selector ... is used for backward navigation to the parent node.

In the following examples, the header data field is to be read with the "InvoiceNo" and the item data field with the "ItemNo."

Notice

In practice, for "ItemNo" it is preferable to define /Document/Item/Item as an .ItemNode[] configuration property and then to address the source field using ItemNo.

XML fragment

XPath expression

<Document>
   <Fields>     
        <InvoiceNo>123456</InvoiceNo>
   </Fields>
</Document>

/Document/Fields/InvoiceNo

or

//InvoiceNo

<Document>
   <Fields>
      <Field Name="InvoiceNo">
         123456
      </Field>
   </Fields>
</Document>

/Document/Fields/Field[@Name='InvoiceNo']

<Document>
   <Fields>
      <Field>      
        <Name>InvoiceNo</Name>        
        <Content>123456</Content>
      </Field>
   </Fields>
</Document>

/Document/Fields/Field/Name[text()='InvoiceNo']/../Content

<Document>
   <Items>
      <Item>
         <ItemNo>1</ItemNo>
      </Item>
      <Item>
         <ItemNo>2</ItemNo>
      </Item>
   </Items>
</Document>

/Document/Items/Item/ItemNo