Details on the XML data source

From Eclipsepedia

Revision as of 10:25, 15 August 2007 by S.bejakovic.gmail.com (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The batch generator comes enabled for use with an XML data source. Any XML file can serve as a data source. Token names are XPath queries that identify nodes in the XML file. If a given XPath identifies more than one node in an XML file, all the nodes will be used for data, with the first node populating the first file in the batch, and subsequent nodes populating subsequent files. If two (or more) XPath queries supply node sets of different size, then an empty string will be inserted when the data from the smaller XPath node set has been exhausted. See the basic tutorial for an example of these aspects of using the XML data source.

A preference page is available to configure the XML data source (accessed through Window->Preferences->OHF H3ET->Batch Generator->XML Batch Data Source). Its main use is to declare the location of the required data source. Additionally, it allows the user to specify a context XPath. This functions as a common base path for all the tokens. For example, if we are using the XPath queries /root/element1 and /root/element2, we could specify /root as the context path, and use element1 and element2 as our tokens. The context path is evaluated as another XPath, therefore use /root instead of /root/ (no final /).