skip to main content
Charts > Developing with design tools > Using the Designer > XML file format > XML structure
 
XML structure
Describes the schema and the Document Type Definition for XML data file, the XML Elements and the Interpretation of Values.
*Schema for XML data file
*Describes the XML elements used to describe data by reference to the file temperatures.xml.
*Document Type Definition for XML data file
*Describes the Document Type Definition (DTD) that presents the Charts XML data file syntax.
*XML elements
*Describes the XML elements used in the example, their attributes, and subelements together with their attributes and subelements.
*Interpretation of values
*Explains some of the values stored in XML data files.
Schema for XML data file
For more details on how the Designer loads data from the temperatures.xml file, see Loading your data.
The XML file used in the examples in Getting started is located in:
<installdir>/jviews-charts/samples/gallery/data/temperatures.xml
For more information, you can also refer to Reading and writing data from an XML source in Developing with the SDK.
This is the XML schema that describes the Charts XML data file syntax. You can find the XML schema in the file:
<installdir>/jviews-charts/data/chartxml.xsd
 
public ProjectViewer()
{
    super("Viewer of Designer for JViews Charts project files");
        JButton button = new JButton("Open Project File");
        button.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
            ...
        }
});
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:element name="chartData">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element ref="data" minOccurs="1" maxOccurs="unbounded"/>
      </xsd:sequence>
      <xsd:attribute name="xmlns:ilvchart" use="fixed"
value="http://www.ilog.com/products/jviews/chart" type="xsd:string"/>
      <xsd:attribute name="version" use="required" type="xsd:string"/>
      <xsd:attribute name="xml:lang" type="xsd:NMTOKEN"/>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="data">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element ref="labels" minOccurs="0" maxOccurs="1"/>
        <xsd:element ref="series" minOccurs="1" maxOccurs="unbounded"/>
      </xsd:sequence>
      <xsd:attribute name="xSeries" type="xsd:IDREF"/>
      <xsd:attribute name="xml:lang" type="xsd:NMTOKEN"/>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="series">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:choice>
          <xsd:element ref="valueOperator" minOccurs="1" maxOccurs="1"/>
          <xsd:choice minOccurs="0" maxOccurs="unbounded">
            <xsd:element ref="value"/>
            <xsd:element ref="valuesList"/>
          </xsd:choice>
        </xsd:choice>
        <xsd:element ref="labels" minOccurs="0" maxOccurs="1"/>
        <xsd:element ref="property" minOccurs="0" maxOccurs="unbounded"/>
      </xsd:sequence>
      <xsd:attribute name="dateFormat" type="xsd:string"/>
      <xsd:attribute name="type" use="required">
        <xsd:simpleType>
          <xsd:restriction base="xsd:string">
            <xsd:enumeration value="double"/>
            <xsd:enumeration value="date"/>
          </xsd:restriction>
        </xsd:simpleType>
      </xsd:attribute>
      <xsd:attribute name="name" type="xsd:string"/>
      <xsd:attribute name="id" use="required" type="xsd:ID"/>
      <xsd:attribute name="xml:lang" type="xsd:NMTOKEN"/>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="labels">
    <xsd:complexType mixed="true">
      <xsd:sequence>
        <xsd:element ref="label" minOccurs="0" maxOccurs="unbounded"/>
      </xsd:sequence>
      <xsd:attribute name="delimiter" type="xsd:string"/>
      <xsd:attribute ref="xml:space" default="preserve"/>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="value">
    <xsd:complexType>
      <xsd:simpleContent>
        <xsd:extension base="xsd:string">
          <xsd:attribute name="xml:lang" type="xsd:NMTOKEN"/>
        </xsd:extension>
      </xsd:simpleContent>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="label">
    <xsd:complexType>
      <xsd:simpleContent>
        <xsd:extension base="xsd:string">
          <xsd:attribute ref="xml:space" default="preserve"/>
          <xsd:whiteSpace value="preserve"/>
        </xsd:extension>
      </xsd:simpleContent>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="valuesList">
    <xsd:complexType>
      <xsd:simpleContent>
        <xsd:extension base="xsd:string">
          <xsd:attribute name="delimiter" type="xsd:string"/>
          <xsd:attribute name="xml:lang" type="xsd:NMTOKEN"/>
        </xsd:extension>
      </xsd:simpleContent>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="valueOperator">
    <xsd:complexType>
      <xsd:choice minOccurs="0" maxOccurs="unbounded">
        <xsd:element ref="seriesRef"/>
        <xsd:element ref="property"/>
      </xsd:choice>
      <xsd:attribute name="class" use="required" type="xsd:NMTOKEN"/>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="seriesRef">
    <xsd:complexType>
      <xsd:attribute name="ref" use="required" type="xsd:IDREF"/>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="property">
    <xsd:complexType>
      <xsd:simpleContent>
        <xsd:extension base="xsd:string">
          <xsd:attribute name="name" use="required" type="xsd:string"/>
          <xsd:attribute name="javaClass" type="xsd:string"/>
        </xsd:extension>
      </xsd:simpleContent>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>
Document Type Definition for XML data file
You can find the DTD in the file:
<installdir>/jviews-charts/data/chartxml.dtd
 
<?xml version="1.0" encoding="UTF-8"?>
 
<!ELEMENT chartData (data+)>
<!ATTLIST chartData xmlns:ilvchart CDATA #FIXED
"http://www.ilog.com/products/jviews/chart"
                    version CDATA #REQUIRED
                    xml:lang NMTOKEN #IMPLIED>
 
<!ELEMENT data (labels?, series+)>
<!ATTLIST data xSeries IDREF #IMPLIED
               xml:lang NMTOKEN #IMPLIED>
 
<!ELEMENT series ((valueOperator | (value | valuesList)*), labels?, property*)>
<!ATTLIST series dateFormat CDATA #IMPLIED
                 type (double | date) #REQUIRED
                 name CDATA #IMPLIED
                 id ID #REQUIRED
                 xml:lang NMTOKEN #IMPLIED>
 
<!ELEMENT labels (#PCDATA | label)*>
<!ATTLIST labels delimiter CDATA #IMPLIED
                 xml:space (preserve) #FIXED 'preserve'>
 
<!ELEMENT value (#PCDATA)>
<!ATTLIST value xml:lang NMTOKEN #IMPLIED>
 
<!ELEMENT label (#PCDATA)>
<!ATTLIST label xml:space (preserve) #FIXED 'preserve'>
 
<!ELEMENT valuesList (#PCDATA)>
<!ATTLIST valuesList delimiter CDATA #IMPLIED
                     xml:lang NMTOKEN #IMPLIED>
 
<!ELEMENT valueOperator (seriesRef|property)*>
<!ATTLIST valueOperator class NMTOKEN #REQUIRED>
 
<!ELEMENT seriesRef EMPTY>
<!ATTLIST seriesRef ref IDREF #REQUIRED>
 
<!ENTITY % propertyExt "">
<!ELEMENT property (#PCDATA %propertyExt;)*>
<!ATTLIST property name CDATA #REQUIRED
                   javaClass CDATA #IMPLIED>
XML elements
Elements are enclosed in angle brackets (< >) in the code in accordance with XML conventions. The content dependent on each element must be terminated by an end tag denoted by a diagonal or solidus (/) followed by the same element name as the start element. For example:
 
<series> ... </series>
For a <property> element, you must give the name of the property (" propertyname ") and its value. The syntax is:
 
<property name="propertyname">value</property>
This section describes the following XML elements:
*The chartData element
*The data element
*The series element
*The valuesList element
*The value element
*The valueOperator element
*The property element
*The labels element
*The label element
*The ?xml-stylesheet? processing instruction
The chartData element
This element is the root element of the XML file. It represents an entire IlvDataSource.
Example
 
<chartData version="1.0">
 <data>
  <series id="Morning_Temperatures" name="Morning Temperatures"
       type="double">
    <valuesList delimiter=",">10.0,8.0,12.0,19.0,10.0,14.0,13.0</valuesList>
   <labels delimiter=",&#10;&#13; ">Monday,Tuesday,Wednesday,Thursday,
                                 Friday,Saturday,Sunday</labels>
  </series>
  <series id="Afternoon_Temperatures" name="Afternoon Temperatures"
          type="double">
    <valuesList delimiter=",">16.0,12.0,20.0,15.0,18.0,24.0,26.0</valuesList>
   <labels delimiter=",&#10;&#13; ">Monday,Tuesday,Wednesday,Thursday,
                                 Friday,Saturday,Sunday</labels>
  </series>
 </data>
</chartData>
chartData Element
Element
Attribute
Default
Description
<chartData>
 
 
An entire IlvDataSource.
Count: 1.
Child elements: <data>
 
version
required
Version of the ChartXML.
Currently “1.0”.
The data element
The < data> element represents one or more IlvDataSets. Typically is represents exactly one IlvDataSet.
Each < data> element can be seen as a table in which each < series> element represents one or two columns. One of these series can be identified as the one holding the x-values. In this case, the other series are assumed to hold the y-values of the considered data.
Series data points might be associated with labels by means of the < labels> element. Labels can be either defined common to all the series of a data element, or individually for each series. In this case, the labels are specified at the < series> element level, and override labels that may have been set on the < data> element.
Example
 
<data>
  <series id="Morning_Temperatures" name="Morning Temperatures"
          type="double">
    <valuesList delimiter=",">10.0,8.0,12.0,19.0,10.0,14.0,13.0</valuesList>
   <labels delimiter=",&#10;&#13; ">Monday,Tuesday,Wednesday,Thursday,
                                 Friday,Saturday,Sunday</labels>
  </series>
  <series id="Afternoon_Temperatures" name="Afternoon Temperatures"
          type="double">
    <valuesList delimiter=",">16.0,12.0,20.0,15.0,18.0,24.0,26.0</valuesList>
   <labels delimiter=",&#10;&#13; ">Monday,Tuesday,Wednesday,Thursday,
                                 Friday,Saturday,Sunday</labels>
  </series>
</data>
data Element
Element
Attribute
Default
Description
<data>
 
 
One or more IlvDataSets.
Child elements: <series>, <labels>.
 
xSeries
 
Represents the ID of a series that contains the x values of the dataset(s) denoted by this <data> element. The other series elements are y values.
The series element
This element specifies a set of values (either X or Y) in an IlvDataSet.
Each series is identified by a unique ID and the type of data it contains (either double values or dates). The dateFormat attribute can be any pattern that conforms to the syntax used by the java.text.SimpleDateFromat class. Values can be expressed with elementary < value> elements, or as a list with the < valuesList> element.
Example
 
<series id="Morning_Temperatures" name="Morning Temperatures"
        type="double">
  <valuesList delimiter=",">10.0,8.0,12.0,19.0,10.0,14.0,13.0</valuesList>
  <labels delimiter=",&#10;&#13; ">Monday,Tuesday,Wednesday,Thursday,
                                Friday,Saturday,Sunday</labels>
</series>
series Element
Element
Attribute
Default
Description
<series>
 
 
An ordered list of values.
Child elements: <valuesList>, <value>, <valueOperator>, <property>, <labels>.
 
id
required
Identifies this element uniquely within the XML file. Used for other series that need to refer to this element.
 
type
required
Element type of the series: either date or double.
 
dateFormat
dd-MMMM-yy
For series of type date, the format of the elements in this XML element is given by this dateFormat attribute. For the interpretation of this string, refer to java.text.SimpleDateFormat.
 
name
 
The user-visible name of this list of values.
The valuesList element
This element represents an ordered list of values. Their type is given by the type attribute of the enclosing <series> element. They are separated by delimiters or white space. The default set of delimiters is only a comma. For numbers, the decimal point is a dot, regardless of the locale. For dates, the format is given by the dateFormat attribute of the enclosing <series> element.
Example
 
<valuesList delimiter=",">10.0,8.0,12.0,19.0,10.0,14.0,13.0</valuesList>
valuesList Element
Element
Attribute
Default
Description
<valuesList>
 
 
An ordered list of values.
 
delimiter
“,”
Set of delimiters (other than white space) that separate the values from each other.
The value element
This element represents a single value. Its type is given by the type attribute of the enclosing <series> element. For numbers, the decimal point is a dot, regardless of the locale. For dates, the format is given by the dateFormat attribute of the enclosing <series> element.
Example
 
<value>19.0</value>
value Element
Element
Attribute
Default
Description
<value>
 
 
A single value.
The valueOperator element
This element represents a list of values, computed from the list of values of another <series> element.
Example
 
<valueOperator class="com.foo.Exponential">
   <seriesRef ref="x"/>
</valueOperator>
valueOperator Element
Element
Attribute
Default
Description
<valueOperaotr>
 
 
Computed list of values.
Child Elements: <seriesRef>, <property>.
 
class
required
The Java™ class name of a subclass of IlvDataSet.
The seriesRef element
This element represents a symbolic reference to a <series> element.
Example
 
<seriesRef ref="x"/>
seriesRef Element
Element
Attribute
Default
Description
<seriesRef>
 
 
Reference to a <series> element.
 
ref
required
The ID of the series being referenced.
The property element
This element represents a property of the enclosing element. In other words, it is a key/value pair, where the key is the name of the property and the value is its contents.
Example
 
<property name="period">20</property>
property Element
Element
Attribute
Default
Description
<property>
 
 
A named property.
 
name
required
The name of the property.
 
javaClass
 
For CSS properties, this specifies the Java class of the property value.
The labels element
This element represents the labels of a series. The labels are in the same order as the data values. They can be specified either as a list of <label> elements, or as the text contents of the <labels> element. In this case, they are separated by delimiters. The default set of delimiters is only a comma. Note that none of the labels can contain one of the delimiter characters.
Example
 
The first possible notation is as follows:
 
<labels>
 
  <label>Monday</label>
 
  <label>Tuesday</label>
 
  <label>Wednesday</label>
 
  <label>Thursday</label>
 
  <label>Friday</label>
 
  <label>Saturday</label>
 
  <label>Sunday</label>
 
</labels>
The second possible notation is as follows:
In this example we have broken the element in two lines, and therefore added the new line and space to the set of delimiter characters.
 
labels delimiter=",&#10;&#13; ">Monday,Tuesday,Wednesday,Thursday,
                               Friday,Saturday,Sunday</labels>
labels Element
Element
Attribute
Default
Description
<labels>
 
 
Labels of a series.
Child elements: <label>
 
delimiter
“,”
Set of delimiters that separate the labels from each other.
The label element
This element represents a single label.
label Element
Element
Attribute
Default
Description
<label>
 
 
A single label.
The ?xml-stylesheet? processing instruction
Specifies a style sheet to be used with the data source. It contains a href attribute containing an URL or a relative file name. It is possible to specify this processing instruction more than once; the style sheets are then cascaded (cumulated).
Example
 
<?xml-stylesheet type="text/jviews+css" href="styles/chart1.css"?>
Interpretation of values
Some of the values stored in XML data files, such as dates, are represented in a particular locale. For example, "28-May-73" is a valid representation of a date in an English locale, but not in a French or Japanese locale.
The XML elements <chartData>, <data>, <series>, <valuesList>, <value> can contain an attribute 'xml:lang'. The value of this attribute is the name of a locale, such as "en-US" for English in the U.S., "ja" for Japanese, or "zh-Hans" for Simplified Chinese. This attribute applies to all values inside this element. An 'xml:lang' attribute on an element overrides the one inherited from the parent element. For further details, see http://www.w3.org/TR/REC-xml/#sec-lang-tag and http://www.w3.org/International/articles/language-tags/Overview.en.php.
When a Charts XML data file is read, the default locale - applied to values that are not inside an element that carries an 'xml:lang' attribute - is the locale of the Java VM.
Since JViews 8.0 patch 3, when a Charts XML data file is saved by the Charts Designer, an 'xml:lang' attribute is attached to the <chartData> element.
Earlier versions saved files without such an attribute. In your application, you can customize the locale used, and whether to use an 'xml:lang' attribute at all, through the method setLocale.

Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.