Conceptually, the XML File Connection differs significantly from the existing database connections. XML files represent a subset of information from a database, which has been prepared by an external application. Therefore the XML File Connection does not query the database for available information like the existing connections do (pull technology), but assumes that the information it is provided with is all that the model will need (push technology).
Main entries are used to access the (single) root element of an XML file, from which all other elements can be accessed. As soon as ITP encounters a main XML entry it will take the next key, and interpret this as the filename of the XML file. If no such key is present, ITP will pop up a standard file selector, so that the user can select the XML file. Consequently, main entries do not have any parameters.
After opening the specified file, and if the correct root element can be found, the XML File Connection will extract the record as specified by the main entry, retrieving and filling in the values of all its fields as specified in the DID. If the file is not a (well-formed) XML file, or if the specified root element cannot be found the DataManager will return an error.
Even though XML files have only a single root element, ITP does not enforce main entries to be singular. The reason for this is that one may want to use the same (plural) entry definition both as a main entry, and as a subentry, probably in a different model, using a different XML file. Typically, if one combines a number of XML files into one big XML file, their single root elements will become part of a new root element, and one will probably want to reuse the same entry definition for both the original XML files, and the combined versions.
The XML File Connection implements a data-push mechanism. It has been optimized for retrieving data from a single XML file, in which all necessary data has been gathered (and that possibly contains more data than needed). Therefore, within a single model, one can access only a single XML file. The Data Manager will deliver a runtime error if one tries to access a second XML file within the same model.
In XML data, each subentry relation is completely specified by inclusion of an XML element within another. This means that subentries cannot be selected via parameters. Consequently, ITP does not allow WHERE clauses in the DEFINE_SUBENTRIES for XML entries.
Just as for Main Entries, Subentries are identified by their tag, and this tag must be specified in the DATA_RETRIEVAL clause. The XML File Connection will search for a subentry within its parent entry in textual order. While doing so it ignores all other XML elements, be it elements with unknown tags, comments, processing instructions or character data. Ignoring comments and processing instructions follows from the XML specifications. Ignoring the other elements has the following reasons:
The structure of an XML file implies that every record is embedded within other records. This makes it impossible to retrieve any sub record without retrieving the enclosing records first. Therefore it is not possible to access XML entries from an external DID module. The XML DID module can access entries from other (non-XML) DID modules. To enforce this restriction ITP forbids importing XML entries in a non-XML DID module.