Corda Server™ can load XML data files, which can be exported by many database and spreadsheet applications. XML files only support data, and not formatting options or data annotations.
Important: Only graphs support XML data files, not maps.
This section is divided into the following topics:
Most newer database systems can export data in an XML format. Corda Server can import most XML files exported by these databases.
It is important to remember that XML data files are not equivalent to ITXML data files. Whereas the former is a general and loose format for describing data, the latter is a small subset of a rigid and robust XML document type created specifically for defining a Corda image. For more information about ITXML, see ITXML.
The example below shows the basic syntax for an XML data file. The italics represent names that are arbitrary. The orange font represents names of graph categories or series.
Note: Most databases export data in this format, which works with Corda Server without modification.
XML Data Syntax
<DataSetName >
<SeriesProperty >
<SeriesNameTag >Series Name </SeriesNameTag >
<CategoryName1 >Data </CategoryName1 >
<CategoryName2 >Data </CategoryName2 >
...
</SeriesProperty >
<SeriesProperty >
...
</SeriesProperty >
...
</DataSetName >
The code sample below shows a basic XML data file, which is available in <document_root>\examples\data\data1.xml.
Note: The XML tag names are irrelevant as long as they are consistent. If possible, use tag names that are meaningful to the data being represented.
Example Data in XML Format
<CarStatus>
<CityInventory>
<City>Atlanta</City>
<Arrivals>23</Arrivals>
<Departures>36</Departures>
<Unused>11</Unused>
<Out_of_Commission>7</Out_of_Commission>
</CityInventory>
<CityInventory>
<City>Boston</City>
<Arrivals>41</Arrivals>
<Departures>17</Departures>
<Unused>25</Unused>
<Out_of_Commission>9</Out_of_Commission>
</CityInventory>
</CarStatus>
Corda Server requires the following XML formatting conventions:
Top-level: Corda Server requires that all XML data be contained within a top-level property, in this case CarStatus.
Data Series: Inside CarStatus are two CityInventory properties, which represent data series. Add an additional series by inserting another CityInventory property. There is no limit to the number of series that can be added.
Data Series Name: Inside CityInventory properties is a City property, which contains the data series' names, Atlanta and Boston in this case. Corda Server always assumes the first property in the Data Series is the data series name.
Data Categories: All remaining properties of CityInventory represent data categories. The names of these properties become the names of the categories; Arrivals, Departures, Unused, and Out of Commission in this case. The data inside each of these properties represent graph data values.
Important: All series properties must contain the exact same properties, in the exact same order.
Because XML property names cannot have spaces in them, use an underscore _ character to represent a space. Thus, Corda Server translates Out_of_Commission to the category name Out of Commission.
Currently, Corda Server does not support importing standard XML data for an X-Y, Time Plot, or Stock graphs. Use ITXML instead.
Important: In order for Corda Server to load any kind of file or data source, it must be given permission to read data from the specified path or domain. For more information, see Setting Path Permissions in the Corda 7 Install and Administration manual.
To import XML data files into graphs, use the loadData() method. The loadData() method accepts two parameters for XML data:
The name of the graph object into which you want to load the data (the default graph name is graph).
The path and file name of the data file. This string can be a URL, a file name relative to <document_root>, or an absolute file name using the Universal Naming Convention (UNC).
Important: ASP/VBScript requires five parameters. The last three parameters are empty strings (““).
For example, to load a data file named <document_root>\data\prices.dat, use the following Corda Embedder method call:
myImage.loadData("graph","data/prices.dat");
Similarly, to load data from a Web application at http://Webapp.mycompany.com/getdata, use the following Corda Embedder method call:
myImage.loadData("graph","http://Webapp.mycompany.com/getdata?year=2002");
Note: The code above assumes a Corda Embedder object named myImage.