public class IlvXMLDataReader extends Object implements IlvDataReader
In order to be properly loaded, the XML document structure should conform to the following 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>
Assuming that a chart contains 3 data sets: 2 (DS_A and DS_B) that do not use xvalues series, 1 (DS_C) using a specific series for its abscissa; the resulting XML file is:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE chartData SYSTEM 'chartxml.dtd'>
<chartData version="1.0">
<data>
<series id="DS_A" type="double">
<valuesList>0.0,8.0,6.0,13.0,22.0,21.0,19.0,28.0,27.0,23.0</valuesList>
</series>
<series id="DS_B" type="double">
<valuesList>0.0,9.0,11.0,14.0,11.0,16.0,19.0,21.0,12.0,12.0</valuesList>
</series>
</data>
<data xSeries="X_DS_C">
<series id="X_DS_C" type="double">
<valuesList>0.0,2.0,4.0,6.0,8.0,10.0,12.0,14.0,16.0,18.0</valuesList>
</series>
<series id="DS_C" type="double">
<valuesList>0.0,0.0,6.0,3.0,0.0,2.0,9.0,18.0,9.0,5.0</valuesList>
</series>
</data>
</chartData>
| Constructor and Description |
|---|
IlvXMLDataReader()
Creates a new
IlvXMLDataReader. |
| Modifier and Type | Method and Description |
|---|---|
protected IlvDataSet |
createDataSet(String name,
double[] xvalues,
double[] yvalues)
Creates a new
IlvDataSet. |
static IlvXMLPropertyReader |
getDefaultPropertyReader()
Returns the default property reader or
null if no default
property reader has been set. |
Document |
getDocument()
Returns the
Document object containing the XML document. |
IlvXMLPropertyReader |
getPropertyReader(String propertyName)
Returns the property reader associated with the specified property, or the
default property reader if the property name is
null. |
String[] |
getStyleSheets()
Returns the CSS style sheets associated with this document.
|
boolean |
isValidating()
Returns the document factory validating mode.
|
IlvDataSet[] |
read(Document document)
Read a chart data model from the specified
org.w3c.dom.Document. |
IlvDataSet[] |
read(InputSource in)
Reads a chart data model from the specified
org.xml.sax.InputSource. |
IlvDataSet[] |
read(InputStream in)
Reads a chart data model from an XML document.
|
IlvDataSet[] |
read(String uri)
Reads a chart data model from an XML document.
|
static void |
registerPropertyReader(String propertyName,
IlvXMLPropertyReader reader)
Associates the specified property reader with the specified property.
|
void |
setPropertyReader(String propertyName,
IlvXMLPropertyReader reader)
Associates the specified property reader with the specified property.
|
void |
setValidating(boolean validate)
Sets the document factory validating mode to the specified value.
|
public static void registerPropertyReader(String propertyName, IlvXMLPropertyReader reader)
null, the specified reader is used as the
default property reader of the class. The default property reader is used
to read a property element when no specific property reader has been
registered for this property. By default, the IlvXMLDataReader
class does not set a default reader.IlvXMLPropertyReaderpublic static IlvXMLPropertyReader getDefaultPropertyReader()
null if no default
property reader has been set.public void setPropertyReader(String propertyName, IlvXMLPropertyReader reader)
null, the specified reader is used as the
default property reader. The scope of this association is limited to this
reader.IlvXMLPropertyReader,
registerPropertyReader(java.lang.String, ilog.views.chart.data.xml.IlvXMLPropertyReader)public IlvXMLPropertyReader getPropertyReader(String propertyName)
null.IlvXMLPropertyReader,
setPropertyReader(java.lang.String, ilog.views.chart.data.xml.IlvXMLPropertyReader)public String[] getStyleSheets()
null if none is specified.public Document getDocument()
Document object containing the XML document.public void setValidating(boolean validate)
false.public boolean isValidating()
protected IlvDataSet createDataSet(String name, double[] xvalues, double[] yvalues)
IlvDataSet. The default implementation returns
an instance of IlvDefaultDataSet. You may override this method
to return an instance of your own class.name - The name of the data set. The string is equal to the y-series ID.xvalues - The x-values array. May be null if no x-values are
defined.yvalues - The y-values array.IlvDefaultDataSetpublic IlvDataSet[] read(InputStream in) throws Exception
read in interface IlvDataReaderin - The byte InputStream containing the document.Exceptionpublic IlvDataSet[] read(String uri) throws Exception
read in interface IlvDataReaderuri - The URI locating the document.Exceptionpublic IlvDataSet[] read(InputSource in) throws Exception
org.xml.sax.InputSource.Exceptionpublic IlvDataSet[] read(Document document) throws IlvXMLDataReaderException
org.w3c.dom.Document.IlvXMLDataReaderException - An error occurred while building datasets.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.