Creating XML
Sources
Creating and Formatting XML Data
To attach an object property to XML
data element, you will need to specify the XML source, data key and, if
the element is tabular, column(s). The XML source is the name, including
path, of the XML source file that will be used to update the object. NOTE:
XML source file names cannot contain spaces. Enterprise RTView does not
limit the number of XML source files you may create. Within each XML source
file, you must format your data using the supported
tags and attributes in the table below.
In order to display your application
data in Enterprise RTView, have your application create an XML source file
using the supported tags. Each time you would like to update an XML data
element, your application must output an updated copy of the XML source
file. NOTE: Do not directly edit XML source files. This will cause errors
if you are writing to the file while Enterprise RTView is attempting to
read it. When creating or updating XML source files, create a temporary
file, write your XML data into it, and then rename the temporary file to
the XML source file name. If your XML source file contains non-English
characters, you must use UTF-8 encoding.
When an XML source file is added, either
from Application Options or directly
in the Attach To Data dialog, Enterprise
RTView will populate Attach to Data drop down menus based on that XML source
file. If you specify (or modify) an XML source using the Application Options
dialog, you may specify whether that XML source is static. Static
XML sources are only read once each time you run Enterprise RTView.
Data Elements: Scalar and Tabular
There are two types of data elements
that you may include in an XML source: Scalar and Tabular.
A Scalar data element is a single value
element. The data value can be a string, an integer or a double. Here is
an example of how to format a Scalar data element in your XML source:
<data key="element1_data" value="10"
/>
data |
Indicates that this is
a scalar data element. |
key |
Assigns a key for this element.
You will select this key in the Attach to Data dialog to attach an object
property to this element. Key names cannot contain spaces. |
value |
Defines the value of this data element. |
If this example was included in an
XML source file named update.xml, you would select the following
options from the Attach To Data drop down menus to connect an object property
to this data element:
Once you Apply this data attachment,
the attached object will update with the value "10".
A Tabular data element contains multiple
columns and rows of data. The value for each field can be a string, an
integer, a double, or a boolean. Tabular data elements are useful for updating
Table and Graph objects in Enterprise RTView. Each time you update tabular
data in your XML source, you must include all of the column and row information.
Here is an example of how to format a Tabular data element in your XML
source:
<table key="production_table">
<tc name="Plant"
type="string"
index="true" />
<tc name="Units in Production"
type="int"
index="false" />
<tr name="PID 0">
<td>San Francisco</td>
<td>99</td>
</tr>
<tr name="PID 1">
<td=San Jose</td>
<td=75</td>
</tr>
</table>
table |
Indicates that this is
a tabular data element. |
key |
Assigns key for this element.
You will select this key in Attach to Data dialog to attach a property
to this element. Key names cannot contain spaces. |
tc |
Indicates that you are defining a
table column. |
name |
Name of the column. Each table
column must have unique name. |
type |
Indicates what type of data will be
included in the column. This field is optional. Valid values are:
string,
double,
int,
boolean
or
date. If the type is not specified, Enterprise RTView will treat
the values in the column as strings. |
index |
This field reserved for future use. |
tr |
Indicates that you are defining a
table row. |
name |
Name of the row. Each table
row must have unique name. |
td |
Defines the value of this field in
the table. |
All of the table columns must be specified
before you specify any row data. The order of the table data elements
in each row should correspond to the order of your columns. For example,
if the first column you specified was a boolean, then the first field you
add to each row must contain a boolean value.
If this example was included in an
XML source file named update.xml, you would select the following
options from the Attach To Data drop down menus to connect an object property
to the Plant column in this data element:
Once you Apply this data attachment,
the attached object will update with the value San Francisco.
Supported Tags and Attributes
The following tags and attributes
in XML data files are supported:
Tag |
Attribute |
Description |
dataset |
xmlns |
Top level tag
that includes the namespace attribute xmlns, which must be defined
as www.sl.com, and the attribute version, which must be defined
as 1.0. (xmlns="www.sl.com" version="1.0") |
version |
data |
key |
Key unique to this data
element. Key names cannot contain spaces. |
value |
Value of this data element |
table |
key |
Key unique to this tabular element.
Key names cannot contain spaces. |
tc |
name |
This is a required field and must
contain a unique column name. All columns must be specified before any
rows are specified. Columns must be specified in the order they will be
displayed in a table. |
type |
Type of data contained in this column.
This will be used for table sorting. If this field is not included or is
invalid, the column will be assigned the type of string. Valid values:
string,
integer,
double,
boolean,
date. |
index |
This field reserved for future use. |
tr |
name |
This is a required field and must
contain a unique row name. |
td |
Value for a cell in this row. Values
must be specified in the order they will be displayed in a table (i.e.:
The first value will be displayed in the first column of the row, etc.)
and must be of the type specified for the corresponding column. |
An example XML data file:
<?xml version="1.0"?>
<dataset xmlns="www.sl.com" version="1.0">
<data key="element1_status"
value="completed" />
<data key="element2_status"
value="broken" />
<data key="element1_load"
value="0.0" />
<data key="element2_load"
value="1102.0" />
<table key="trade_table">
<tc name="Customer"
type="string"
index="true" />
<tc name="Symbol"
type="string"
index="false" />
<tc name="Shares"
type="int"
index="false" />
<tc name="Purchase Price"
type="double"
index="false" />
<tc name="Current"
type="double"
index="false" />
<tc name="High"
type="double"
index="false" />
<tc name="Low"
type="double"
index="false" />
<tr name="TID 0">
<td>Alice Chen</td>
<td>IBM</td>
<td>18</td>
<td>44.7</td>
<td>27.5</td>
<td>177.5</td>
<td>17.5</td>
</tr>
<tr name="TID 1">
<td>Betty Jones</td>
<td>CVTX</td>
<td>19</td>
<td>32.0</td>
<td>10.8</td>
<td>160.8</td>
<td>0.8</td>
</tr>
<tr name="TID 2">
<td>Chris Smith</td>
<td>AWE</td>
<td>61</td>
<td>98.6</td>
<td>4.1</td>
<td>154.1</td>
<td>0.1</td>
</tr>
</table>
</dataset>
Data Simulator
A sample data
simulator is provided to allow you to work with Enterprise
RTView
without setting up your own XML data. The simulator creates and updates
a group of data elements according to information specified in a data file.
These data elements are given initial values and output to the initialization
file init.xml. Once every update period the values for these data
elements are updated and output to the update file update.xml.
On Windows
You can start from either
the Windows Start Menu or the Command Prompt window.
From
the Windows Start Menu:
|
Select Start-->Programs-->Enterprise
RTView-->Demos-->Simulator-->XML Simulator |
NOTE: The XML
simulator outputs XML files to the directory where it is started. When
you start the XML simulator from the Windows Start menu, it starts in the
demos
directory in your Enterprise RTView installation. To start the XML simulator
in another directory, you must run it from a command window.
From
an
initialized
command window :
On UNIX
From
an
initialized
terminal window :
By default, the
update period is set to 2000 milliseconds (2 seconds) to match to default
update period for Enterprise RTView. To change the update period, you
must run the XML simulator from a command prompt or terminal window and
specify
the desired rate on the command line using -u. For example, the following
will set the update period to 1 second:
run_simdata -u1000
The data simulator
outputs the following values:
Data
Key |
Data
Type |
Data
Description |
element1_load |
double |
Value starts
at 20 and ranges between 0 and 100, updating by 5. |
element1_status |
string |
Value iterates
through the following values:
working, broken, waiting, completed |
element1_data |
int |
Value starts
at 15 and ranges between 0 and 100, updating by 10. |
element2_load |
double |
Value starts
at 10 and ranges between 0 and 100, updating by 7. |
element2_status |
string |
Value iterates
through the following values:
waiting, completed, working, broken |
element2_data |
int |
Value starts
at 5 and ranges between 0 and 100, updating by 12. |
production_table |
tabular |
Table containing 15 rows of 5 columns:
Column name="Plant" type="string"
(does not change)
Column name="Units in Production"
type="int" (changes each update period)
Column name="Units Completed" type="int"
(changes each update period)
Column name="Status" type="string"
(changes each update period)
Column name="On Schedule" type="boolean"
(changes each update period) |
system_table |
tabular |
Table containing 15 rows of 5 columns:
Column name="System" type="string"
(does not change)
Column name="Status" type="string"
(changes each update period)
Column name="%Free Space" type="double"
(changes each update period)
Column name="CPU Usage" type="int"
(changes each update period)
Column name="On Site" type="boolean"
(does not change) |
trade_table |
tabular |
Table containing 100 rows of 7 columns:
Column name="Customer" type="string"
(does not change)
Column name="Symbol" type="string"
(does not change)
Column name="Shares" type="int" (does
not change)
Column name="Purchase Price" type="double"
(does not change)
Column name="Current" type="double"
(changes each update period)
Column name="High" type="double" (changes
only if current values gets higher than this value)
Column name="Low" type="double" (changes
only if current values gets lower than this value) |
Additionally, the simulator will output
the following data keys when using the default data file:
Data
Key |
Data
Type |
Data
Description |
step50_150by10 |
int |
Value ranges
between 50 and 150, updating by 10. |
step-100_100by10 |
int |
Value ranges
between -100 and 100, updating by 10. |
step50_75 |
int |
Value ranges
between 50 and 75, updating by 1. |
step0_100 |
int |
Value ranges
between 0 and 100, updating by 1. |
step0_50by2.5 |
double |
Value ranges
between 0 and 50, updating by 2.5. |
step0_100by5.0 |
double |
Value ranges
between 0 and 100, updating by 5. |
step-10_150.0 |
double |
Value ranges
between -10 and 150, updating by 1. |
random0_100 |
int |
Value is a
randomly generated number between 0 and 100. |
random0_100.0 |
double |
Value is a
randomly generated number between 0 and 100. |
step_100 |
int |
Value ranges
between 0 and 100, updating by 1. |
step_circ_50_200.0 |
double |
Value ranges
between 50 and 150, updating by 1. |
You may create your own data file for
use with the simulator, however tabular data cannot be generated from a
data file.
Use the following syntax to create
custom data files:
Command |
Description |
key
step min max start increment |
The
key value initially equals start and then increases by increment until
max is reached. Then it decreases by increment until min is reached
and starts over. |
key
step_circ min max start increment |
The
key value initially equals start and then increases by increment until
max is reached. Then it starts over at min. |
key
random min max |
The
value of the key is randomly assigned to a number between min and max. |
From the command line, specify the
name of the custom data file for the simulator to use:
run_simdata mydatfile
An example data file:
step50_75
step 50 75 50 1
step0_100
step 0 100 0 1
step0_50by2.5
step 0 50. 0 2.5
step0_100by5.0
step 0 100. 0 5
step-10_150.0
step -10 150 -10 1
random0_100
random 0 100
random0_100.0
random 0 100.
step_100
step 0 100
step_circ_50_200.0 step_circ
50 200.
|