To create an XML data source to access an XML document, right-click on the Elements Tree and click New > Data source > XML.
The Tool will display the dialog to create the data source.
The following data are requested in this dialog:
Name. Name of the new data source.
Data Route. Path to the XML file that contains the required data. This path can be parameterized by using interpolation variables (see section Paths and Other Values with Interpolation Variables).
Validation type. If selected, the structure of the input XML file will be obtained from a Schema or a DTD. If “None” is selected, Virtual DataPort will analyze the XML document to infer its schema.
Validate route. Path to the Schema (XSD) or DTD of the input XML document. If present, instead of obtaining the XML document from the “Data Route” to calculate the schema of the new base view, the Server will use the contents of the XSD or the DTD.
The path to the Schema or DTD cannot contain interpolation variables. I.e. this path cannot be parameterized and therefore, you have to provide its path when creating the data source.
If you select the option Schema and the schema has more than one root element, when you create a base view over this data source, you will have to select the root type of the schema. That is, from which element the schema of the base view will be calculated from (see Creating an XML data source with a Schema that has multiple root elements).
Validate data. If selected, Virtual DataPort will validate the input XML file every time the data source is accessed.
The path formats available are described in detail in the section Path Types in Virtual DataPort.
In the Metadata tab, you can set the folder where the data source will be stored and provide a description.
Click Save to create the data source.
When editing the data source, you can also change its owner by clicking the button .
After creating the data source, click Create base view to create a base view over this data source. The Tool will display the “Configure XML Wrapper” dialog where you have to select one of these options (see Creating an XML base view):
Do not stream output. With this option, the new base view represents the compound values with the compound types
register. Then, you can create a Flatten view (see section Creating Flatten Views) over this base view to transform the results in a way that is easy to combine with data from other sources.
Stream output at the specified level. With this option, the Server optimizes the processing of the XML document so it does not require the entire response to be realized in memory before processing it. Therefore, the memory consumption is much lower. When the base view is created with the first option (“Do not stream output”), the Server reads the entire XML document and then parses it thus having to store the entire message in memory.
The drawback of using the “Stream output at the specified level” option over the other one is that with this option, the fields of the XML document “below” the selected level are ignored.
The section Dealing with Web Service Operations that Return Compound Values explains this issue in detail.
After clicking Ok, the Tool will display the schema of the base view associated with the source. At this stage, you can do the following:
- Change the name of the view.
- Change the name of each field by double-clicking it and its type, by using the drop-down list to the right.
- Set the primary key of the new view (see the section Primary Keys of Views).
- In the Metadata tab, you can set the folder where the base view will be stored and provide a description.
- When editing the base view, you can also change its owner by clicking the button .
After this, click Save () to create the base view.
In the Elements Tree, double-click the new base view to display its schema (see section Creating Derived Views).
You can edit the schema of the view by clicking Edit.