2002-03-10 11:16:03 -05:00
|
|
|
<html>
|
|
|
|
<head>
|
2002-03-15 20:41:58 -05:00
|
|
|
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
|
|
<meta content="text/html; charset=ISO-8859-1">
|
2002-03-10 11:16:03 -05:00
|
|
|
<title>Record Generator HOWTO</title>
|
2002-03-15 20:41:58 -05:00
|
|
|
<style type="text/css">
|
|
|
|
body { background-color: white; font-size: normal; color: black ; }
|
|
|
|
a { color: #525d76; }
|
|
|
|
a.black { color: #000000;}
|
|
|
|
table {border-width: 0; width: 100%}
|
|
|
|
table.centered {text-align: center}
|
|
|
|
table.title {text-align: center; width: 80%}
|
|
|
|
img{border-width: 0;}
|
|
|
|
span.s1 {font-family: Helvetica, Arial, sans-serif; font-weight: bold; color: #000000; }
|
|
|
|
span.s1_white { font-family: Helvetica, Arial, sans-serif; font-weight: bold; color: #ffffff; }
|
|
|
|
span.title {font-family: Helvetica, Arial, sans-serif; font-weight: bold; color: #000000; }
|
|
|
|
span.c1 {color: #000000; font-family: Helvetica, Arial, sans-serif}
|
|
|
|
tr.left {text-align: left}
|
|
|
|
hr { width: 100%; size: 2}
|
|
|
|
</style>
|
2002-03-10 11:16:03 -05:00
|
|
|
</head>
|
2002-03-15 20:41:58 -05:00
|
|
|
<body>
|
|
|
|
<table width="100%" cellspacing="0" cellpadding="0" border="0">
|
2002-03-10 11:16:03 -05:00
|
|
|
<tr>
|
2002-03-15 20:41:58 -05:00
|
|
|
<td valign="top" align="left"><a href="http://jakarta.apache.org/index.html"><img hspace="0" vspace="0" border="0" src="images/jakarta-logo.gif"></a></td><td width="100%" valign="top" align="left" bgcolor="#ffffff"><img hspace="0" vspace="0" border="0" align="right" src="images/header.gif"></td>
|
2002-03-10 11:16:03 -05:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2002-03-15 20:41:58 -05:00
|
|
|
<td colspan="2" bgcolor="#525d76"><span class="c1"><a class="black" href="http://www.apache.org/">www.apache.org ></a><a class="black" href="http://jakarta.apache.org/">jakarta.apache.org ></a><a href="http://jakarta.apache.org/poi/" class="black">jakarta.apache.org/poi</a></span></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td height="8"></td>
|
2002-03-10 11:16:03 -05:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
|
|
|
<tr>
|
2002-03-15 20:41:58 -05:00
|
|
|
<td width="1%">
|
2002-03-10 11:16:03 -05:00
|
|
|
<br>
|
2002-03-15 20:41:58 -05:00
|
|
|
</td><td nowrap="1" valign="top" width="14%">
|
|
|
|
<hr>
|
|
|
|
<span class="s1">Navigation</span>
|
2002-03-10 11:16:03 -05:00
|
|
|
<br>
|
2002-03-15 20:41:58 -05:00
|
|
|
<a class="s1" href="../index.html">Main</a>
|
2002-03-10 11:16:03 -05:00
|
|
|
<br>
|
2002-03-15 20:41:58 -05:00
|
|
|
<hr>
|
|
|
|
<span class="s1">HSSF</span>
|
2002-03-10 11:16:03 -05:00
|
|
|
<br>
|
2002-03-15 20:41:58 -05:00
|
|
|
<a class="s1" href="how-to.html">HOWTO</a>
|
|
|
|
<br>
|
|
|
|
<a class="s1" href="use-case.html">Use Case</a>
|
|
|
|
<br>
|
|
|
|
<a class="s1" href="diagrams.html">Pictorial Docs</a>
|
2002-03-10 11:16:03 -05:00
|
|
|
<br>
|
2002-03-15 20:41:58 -05:00
|
|
|
<hr>
|
|
|
|
<span class="s1">Contributer's Guide</span>
|
2002-03-10 11:16:03 -05:00
|
|
|
<br>
|
2002-03-15 20:41:58 -05:00
|
|
|
<a class="s1" href="record-generator.html">Record Generator</a>
|
|
|
|
<br>
|
|
|
|
</td><td width="1%">
|
|
|
|
<br>
|
|
|
|
</td><td align="left" valign="top" width="*">
|
2002-03-10 11:16:03 -05:00
|
|
|
<title>Record Generator HOWTO</title>
|
2002-03-15 20:41:58 -05:00
|
|
|
<table width="100%" align="center" class="centered">
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td align="center">
|
|
|
|
<table border="0" cellpadding="1" cellspacing="0" class="title">
|
|
|
|
<tbody>
|
2002-03-10 11:16:03 -05:00
|
|
|
<tr>
|
2002-03-15 20:41:58 -05:00
|
|
|
<td bgcolor="#525d76">
|
|
|
|
<table width="100%" border="0" cellpadding="2" cellspacing="0" class="centered">
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td bgcolor="#f3dd61"><span class="title">Record Generator HOWTO</span></td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</td>
|
2002-03-10 11:16:03 -05:00
|
|
|
</tr>
|
2002-03-15 20:41:58 -05:00
|
|
|
</tbody>
|
2002-03-10 11:16:03 -05:00
|
|
|
</table>
|
|
|
|
<font size="-2" color="#000000">
|
|
|
|
<p>
|
|
|
|
<a href="mailto:"></a>
|
|
|
|
</p>
|
|
|
|
</font>
|
|
|
|
<div align="right">
|
|
|
|
<table cellspacing="0" cellpadding="2" border="0" width="100%">
|
|
|
|
<tr>
|
|
|
|
<td bgcolor="#525D76"><font color="#ffffff" size="+1"><font face="Arial,sans-serif"><b>How to Use the Record Generator</b></font></font></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<br>
|
|
|
|
|
|
|
|
|
|
|
|
<div align="right">
|
|
|
|
<table cellspacing="0" cellpadding="2" border="0" width="99%">
|
|
|
|
<tr>
|
|
|
|
<td bgcolor="#525D76"><font color="#ffffff" size="+0"><font face="Arial,sans-serif"><b>History</b></font></font></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<br>
|
|
|
|
|
|
|
|
<p align="justify">
|
|
|
|
The record generator was born from frustration with translating
|
|
|
|
the Excel records to Java classes. Doing this manually is a time
|
|
|
|
consuming process. It's also very easy to make mistakes.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p align="justify">
|
|
|
|
A utility was needed to take the defintition of what a
|
|
|
|
record looked like and do all the boring stuff. Thus the
|
|
|
|
record generator was born.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
<br>
|
|
|
|
|
|
|
|
|
|
|
|
<div align="right">
|
|
|
|
<table cellspacing="0" cellpadding="2" border="0" width="99%">
|
|
|
|
<tr>
|
|
|
|
<td bgcolor="#525D76"><font color="#ffffff" size="+0"><font face="Arial,sans-serif"><b>Capabilities</b></font></font></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<br>
|
|
|
|
|
|
|
|
<p align="justify">
|
|
|
|
The record generator takes XML as input and produced the following
|
|
|
|
output:
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
<li>A Java file capabile of decoding and encoding the record.</li>
|
|
|
|
|
|
|
|
<li>A test class with provides a fill-in-the-blanks implementation of a test case
|
|
|
|
for ensuring the record operates as designed.</li>
|
|
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
<br>
|
|
|
|
|
|
|
|
<div align="right">
|
|
|
|
<table cellspacing="0" cellpadding="2" border="0" width="99%">
|
|
|
|
<tr>
|
|
|
|
<td bgcolor="#525D76"><font color="#ffffff" size="+0"><font face="Arial,sans-serif"><b>Usage</b></font></font></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<br>
|
|
|
|
|
|
|
|
<p align="justify">
|
|
|
|
The record generator is invoked as an Ant target (generate-records). It goes
|
|
|
|
through looking for all files in src/records/defintitions ending with _record.xml.
|
|
|
|
It then creates two files; the Java record definition and the Java test case template.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p align="justify">
|
|
|
|
The records themselves have the following general layout:
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<div align="center">
|
|
|
|
<table cellspacing="2" cellpadding="2" border="1">
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<pre>
|
|
|
|
<record id="0x1032" name="Frame" package="org.apache.poi.hssf.record">
|
|
|
|
<description>The frame record indicates whether there is a border
|
|
|
|
around the displayed text of a chart.</description>
|
|
|
|
<author>Glen Stampoultzis (glens at apache.org)</author>
|
|
|
|
<fields>
|
|
|
|
<field type="int" size="2" name="border type">
|
|
|
|
<const name="regular" value="0" description="regular rectangle or no border"/>
|
|
|
|
<const name="shadow" value="1" description="rectangle with shadow"/>
|
|
|
|
</field>
|
|
|
|
<field type="int" size="2" name="options">
|
|
|
|
<bit number="0" name="auto size"
|
|
|
|
description="excel calculates the size automatically if true"/>
|
|
|
|
<bit number="1" name="auto position"
|
|
|
|
description="excel calculates the position automatically"/>
|
|
|
|
</field>
|
|
|
|
</fields>
|
|
|
|
</record>
|
|
|
|
</pre>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<p align="justify">
|
|
|
|
Currently the type can be of type int, float or string. The 'int'
|
|
|
|
type covers bytes, shorts and integers which is selected using a
|
|
|
|
size of 1, 2 or 4. An additional type called varword is used to
|
|
|
|
represent a array of word values where the first short is the length
|
|
|
|
of the array. The string type generation is only partially
|
|
|
|
implemented. If choosing string you must select a size of 'var'.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p align="justify">
|
|
|
|
The Java records are regenerated each time the record generator is
|
|
|
|
run, however the test stubs are only created if the test stub does
|
|
|
|
not already exist. What this means is that you may change test
|
|
|
|
stubs but not the generated records.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
<br>
|
|
|
|
|
|
|
|
<div align="right">
|
|
|
|
<table cellspacing="0" cellpadding="2" border="0" width="99%">
|
|
|
|
<tr>
|
|
|
|
<td bgcolor="#525D76"><font color="#ffffff" size="+0"><font face="Arial,sans-serif"><b>How it Works</b></font></font></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<br>
|
|
|
|
|
|
|
|
<p align="justify">
|
|
|
|
The record generation works by taking an XML file and styling it
|
|
|
|
using XLST. Given that XSLT is a little limited in some ways it was
|
|
|
|
necessary to add a little Java code to the mix.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p align="justify">
|
|
|
|
See record.xsl, record_test.xsl, FieldIterator.java,
|
|
|
|
RecordUtil.java, RecordGenerator.java
|
|
|
|
</p>
|
|
|
|
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
<br>
|
|
|
|
|
|
|
|
<div align="right">
|
|
|
|
<table cellspacing="0" cellpadding="2" border="0" width="99%">
|
|
|
|
<tr>
|
|
|
|
<td bgcolor="#525D76"><font color="#ffffff" size="+0"><font face="Arial,sans-serif"><b>Limitations</b></font></font></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<br>
|
|
|
|
|
|
|
|
<p align="justify">
|
|
|
|
The record generator does not handle all possible record types and
|
|
|
|
is not ment to. Sometimes it's going to make more sense to generate
|
|
|
|
the records manually. The main point of this thing is to make the
|
|
|
|
easy stuff simple.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p align="justify">
|
|
|
|
Currently the record generator is optimized to create Excel records.
|
|
|
|
It could be adapted to create Word records with a little poking
|
|
|
|
around.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p align="justify">
|
|
|
|
Currently the the XSL file that generates the record calls out to
|
|
|
|
Java objects. This would have been better done as Javascript inside
|
|
|
|
the XSL file itself. The Java code for the record generation is
|
|
|
|
currently quite messy with minimal comments.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
<br>
|
|
|
|
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
<br>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
<br>
|
2002-03-15 20:41:58 -05:00
|
|
|
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
|
|
|
<tbody>
|
2002-03-10 11:16:03 -05:00
|
|
|
<tr>
|
|
|
|
<td>
|
2002-03-15 20:41:58 -05:00
|
|
|
<hr noshade="" size="1">
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td align="center"><i>Copyright © 2002 Apache Software Foundation</i></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td align="right" width="100%">
|
|
|
|
<br>
|
2002-03-10 11:16:03 -05:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2002-03-15 20:41:58 -05:00
|
|
|
<td align="right" width="100%"><a href="http://krysalis.org/"><img alt="Krysalis Logo" src="images/krysalis-compatible.png"></a><a href="http://xml.apache.org/cocoon/"><img alt="Cocoon Logo" src="images/built-with-cocoon.png"></a></td>
|
2002-03-10 11:16:03 -05:00
|
|
|
</tr>
|
2002-03-15 20:41:58 -05:00
|
|
|
</tbody>
|
2002-03-10 11:16:03 -05:00
|
|
|
</table>
|
|
|
|
</body>
|
|
|
|
</html>
|