JMSLTM Numerical Library 5.0.1

com.imsl.chart.xml
Class ChartXML

java.lang.Object
  extended by com.imsl.chart.xml.ChartXML
All Implemented Interfaces:
ErrorHandler

public class ChartXML
extends Object
implements ErrorHandler

Create a Chart from an XML file.

See Also:
Chart Programmer's Guide: XML

Constructor Summary
ChartXML(Document document)
          Creates a ChartXML from a DOM tree.
ChartXML(InputSource source, boolean validating)
          Creates a ChartXML from an XML source.
ChartXML(String filename)
          Creates a ChartXML from an XML file.
ChartXML(String filename, boolean validating)
          Creates a ChartXML from an XML file.
 
Method Summary
 void error(SAXParseException exception)
          Receive notification of a recoverable error.
protected  void error(String key, Object[] args)
          Handles error messages.
 void fatalError(SAXParseException exception)
          Receive notification of a non-recoverable error.
 Object get(String id)
          Returns a generated object given the id attribute in the XML tag that created the object.
 Chart getChart()
          Returns the root node of the chart tree.
protected static Integer getEnumValue(String value)
          Returns the int corresponding to an enumeration.
 Set keySet()
          Returns the Set view of all id's defined in the XML file.
static void main(String[] argv)
          Displays a chart created from an XML file.
protected  Object stringToObject(Class theClass, String value)
          Converts a String into an Object of the given class.
 void warning(SAXParseException exception)
          Receive notification of a warning.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChartXML

public ChartXML(Document document)
         throws SAXException
Creates a ChartXML from a DOM tree.

Parameters:
document - is a description of a chart.
Throws:
SAXException

ChartXML

public ChartXML(InputSource source,
                boolean validating)
         throws SAXException,
                IOException,
                ParserConfigurationException
Creates a ChartXML from an XML source.

Parameters:
source - is an InputSource containing an XML description of a chart.
validating - is true if a validating parser is to be used.
Throws:
IOException - if there is a problem reading the source.
SAXException - if there is a problem parsing the source.
ParserConfigurationException - if there is a problem configuring the XML parser.

ChartXML

public ChartXML(String filename)
         throws SAXException,
                IOException,
                ParserConfigurationException
Creates a ChartXML from an XML file. A validating XML parser is used.

Parameters:
filename - is the name of a file containing an XML description of a chart.
Throws:
IOException - if there is a problem reading the file.
SAXException - if there is a problem parsing the file.
ParserConfigurationException - if there is a problem configuring the XML parser.

ChartXML

public ChartXML(String filename,
                boolean validating)
         throws SAXException,
                IOException,
                ParserConfigurationException
Creates a ChartXML from an XML file.

Parameters:
filename - is the name of a file containing an XML description of a chart.
validating - is true if a validating parser is to be used.
Throws:
IOException - if there is a problem reading the file.
SAXException - if there is a problem parsing the file.
ParserConfigurationException - if there is a problem configuring the XML parser.
Method Detail

error

public void error(SAXParseException exception)
Receive notification of a recoverable error.

Specified by:
error in interface ErrorHandler

error

protected void error(String key,
                     Object[] args)
Handles error messages.

Parameters:
key - is the key to the error message string in the ErrorMessages bundle in this package.
args - are the arguments to be filled into the error message string.

fatalError

public void fatalError(SAXParseException exception)
Receive notification of a non-recoverable error.

Specified by:
fatalError in interface ErrorHandler

get

public Object get(String id)
Returns a generated object given the id attribute in the XML tag that created the object. This allows charts generated from XML files to be programmatically manipulated.


getChart

public Chart getChart()
Returns the root node of the chart tree.


getEnumValue

protected static Integer getEnumValue(String value)
Returns the int corresponding to an enumeration. The resource bundle Enum in this package is searched for the value.


keySet

public Set keySet()
Returns the Set view of all id's defined in the XML file.


main

public static void main(String[] argv)
                 throws Exception
Displays a chart created from an XML file. Usage: java com.imsl.chart.xml.ChartXML filename

Throws:
Exception

stringToObject

protected Object stringToObject(Class theClass,
                                String value)
Converts a String into an Object of the given class.


warning

public void warning(SAXParseException exception)
Receive notification of a warning.

Specified by:
warning in interface ErrorHandler

JMSLTM Numerical Library 5.0.1

Copyright © 1970-2008 Visual Numerics, Inc.
Built July 8 2008.