|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.cocoon.util.AbstractLogEnabled
org.apache.cocoon.generation.FileGeneratorBean
org.apache.cocoon.generation.CSVGeneratorBean
A simple parser converting a Comma Separated Values (CSV) file into XML.
This parser is controlled by the following sitemap parameters:
The generated output will look something like the following:
<?xml version="1.0" encoding="ISO-8859-1"?>
<csv:document xmlns:csv="http://apache.org/cocoon/csv/1.0">
<csv:header>
<csv:column number="1">Column A</csv:column>
<csv:column number="2">Column B</csv:column>
<csv:column number="3">Column C</csv:column>
</csv:header>
<csv:record number="1">
<csv:field number="1" column="Column A">Field A1</csv:field>
<csv:field number="2" column="Column B">Field B1</csv:field>
<csv:field number="3" column="Column C">Field C1</csv:field>
</csv:record>
<csv:record number="2">
<csv:field number="1" column="Column A">Field A2</csv:field>
<csv:field number="2" column="Column B">Field B2</csv:field>
<csv:field number="3" column="Column C">Field C2</csv:field>
</csv:record>
</csv:document>
Note that this generator has been thoroughly tested with CSV files generated by Microsoft Excel. Unfortunately no official CSV specification has ever been published by any standard body, so the interpretation of the format might be slightly different in cases.
| Field Summary | |
static String |
NAMESPACE_PREFIX
The namespace prefix of XML generated by this instance. |
static String |
NAMESPACE_URI
The namespace URI of XML generated by this instance. |
| Fields inherited from class org.apache.cocoon.generation.FileGeneratorBean |
consumer, inputSource, parser, resolver |
| Fields inherited from interface org.apache.cocoon.generation.Generator |
ROLE |
| Constructor Summary | |
CSVGeneratorBean()
Create a new CSVGeneratorBean instance. |
|
| Method Summary | |
void |
dispose()
|
void |
generate()
Generate XML data from a Comma Separated Value resource. |
Serializable |
getKey()
Generate the unique key. |
void |
setup(org.apache.cocoon.environment.SourceResolver resolver,
Map object_model,
String source,
Parameters parameters)
Setup this CSVGeneratorBean instance. |
| Methods inherited from class org.apache.cocoon.generation.FileGeneratorBean |
getValidity, setConsumer, setParser |
| Methods inherited from class org.apache.cocoon.util.AbstractLogEnabled |
getLogger, setLogger |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final String NAMESPACE_URI
The namespace URI of XML generated by this instance.
public static final String NAMESPACE_PREFIX
The namespace prefix of XML generated by this instance.
| Constructor Detail |
public CSVGeneratorBean()
Create a new CSVGeneratorBean instance.
| Method Detail |
public void dispose()
dispose in interface org.apache.cocoon.sitemap.DisposableSitemapComponentdispose in class FileGeneratorBeanServiceableGenerator.dispose()
public void setup(org.apache.cocoon.environment.SourceResolver resolver,
Map object_model,
String source,
Parameters parameters)
throws org.apache.cocoon.ProcessingException,
SAXException,
IOException
Setup this CSVGeneratorBean instance.
setup in interface org.apache.cocoon.sitemap.SitemapModelComponentsetup in class FileGeneratorBeanorg.apache.cocoon.ProcessingException
SAXException
IOExceptionSitemapModelComponent.setup(SourceResolver, Map, String, Parameters)public Serializable getKey()
Generate the unique key.
getKey in interface org.apache.cocoon.caching.CacheableProcessingComponentgetKey in class FileGeneratorBean
public void generate()
throws IOException,
SAXException,
org.apache.cocoon.ProcessingException
Generate XML data from a Comma Separated Value resource.
.
generate in interface org.apache.cocoon.generation.Generatorgenerate in class FileGeneratorBeanIOException
SAXException
org.apache.cocoon.ProcessingException
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||