JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.util.xml
Class JCTableXMLParser

java.lang.Object
  |
  +--com.klg.jclass.util.xml.JCTableXMLParser
All Implemented Interfaces:
Serializable

public class JCTableXMLParser
extends Object
implements Serializable

This class takes in a stream of data and parses it under the assumption that it is in the defined XML format that LiveTable uses. It then passes the data to the given JCTablePopulator instance.

The XML LiveTable format looks like this:

 <?xml version="1.0"?>
 <!DOCTYPE JCTableData SYSTEM "JCTableData.dtd">
 <JCTableData>
   <Row>
     <Cell>1</Cell> <Cell>2</Cell> <Cell>3</Cell> <Cell>4</Cell>
   </Row>
   <Row>
     <Cell>1</Cell> <Cell>2</Cell> <Cell>3</Cell> <Cell>4</Cell>
   </Row>
 </JCTableData>
 
Or, with row and column labels:
 <?xml version="1.0"?>
 <!DOCTYPE JCTableData SYSTEM "JCTableData.dtd">
 <JCTableData>
   <ColumnLabel>Column 1</ColumnLabel>
   <ColumnLabel>Column 2</ColumnLabel>
   <ColumnLabel>Column 3</ColumnLabel>
   <ColumnLabel>Column 4</ColumnLabel>
   <Row>
     <RowLabel>Row 1</RowLabel>
     <Cell>1</Cell> <Cell>2</Cell> <Cell>3</Cell> <Cell>4</Cell>
   </Row>
   <Row>
     <RowLabel>Row 2</RowLabel>
     <Cell>1</Cell> <Cell>4</Cell> <Cell>9</Cell> <Cell>16</Cell>
   </Row>
   <Row>
     <RowLabel>Row 3</RowLabel>
     <Cell>1</Cell> <Cell>16</Cell> <Cell>81</Cell> <Cell>256</Cell>
   </Row>
 </JCTableData>
 

See Also:
Serialized Form

Field Summary
protected  boolean isDebug
          Flag indicating whether parsing is in debug mode, which turns on error messages on error out.
static String XML_DS
           
static String XML_DS_COLUMNLABEL
           
static String XML_DS_ROW
           
static String XML_DS_ROW_CELL
           
static String XML_DS_ROWLABEL
           
 
Constructor Summary
JCTableXMLParser()
           
 
Method Summary
protected  Object cvtToTableValue(String value)
          Converts a String from the xml data into a table value.
 void readAndParse(Reader r, com.klg.jclass.util.xml.JCTablePopulator pop)
          Reads and parses table data in the defined XML format.
protected  void readTableData(Document xml, com.klg.jclass.util.xml.JCTablePopulator pop)
          Reads the table data from the given xml document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XML_DS

public static final String XML_DS
See Also:
Constant Field Values

XML_DS_COLUMNLABEL

public static final String XML_DS_COLUMNLABEL
See Also:
Constant Field Values

XML_DS_ROWLABEL

public static final String XML_DS_ROWLABEL
See Also:
Constant Field Values

XML_DS_ROW

public static final String XML_DS_ROW
See Also:
Constant Field Values

XML_DS_ROW_CELL

public static final String XML_DS_ROW_CELL
See Also:
Constant Field Values

isDebug

protected boolean isDebug
Flag indicating whether parsing is in debug mode, which turns on error messages on error out.

Constructor Detail

JCTableXMLParser

public JCTableXMLParser()
Method Detail

readAndParse

public void readAndParse(Reader r,
                         com.klg.jclass.util.xml.JCTablePopulator pop)
                  throws IOException,
                         JCParseException
Reads and parses table data in the defined XML format.

Parameters:
r - reader open on an active stream
pop - JCTablePopulator instance with which to set table data
Throws:
IOException
JCParseException

readTableData

protected void readTableData(Document xml,
                             com.klg.jclass.util.xml.JCTablePopulator pop)
                      throws IOException
Reads the table data from the given xml document.

Parameters:
xml - the xml document to parse
pop - the JCTablePopulator instance with which to set the newly parsed data
Throws:
IOException

cvtToTableValue

protected Object cvtToTableValue(String value)
Converts a String from the xml data into a table value. If it will convert to a double, do that. Otherwise, keep it as a String.

Parameters:
value -
Returns:

Copyright © 2004 Quest Software Inc..
All rights reserved.