|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.cocoon.pipeline.component.AbstractPipelineComponent org.apache.cocoon.sax.AbstractSAXPipelineComponent org.apache.cocoon.sax.AbstractSAXProducer org.apache.cocoon.sax.AbstractSAXGenerator org.apache.cocoon.optional.pipeline.components.sax.csv.CSVGenerator
public class CSVGenerator
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. |
Constructor Summary | |
---|---|
CSVGenerator()
Create a new CSVGenerator instance. |
|
CSVGenerator(String csv)
|
Method Summary | |
---|---|
void |
execute()
|
void |
recycle()
|
void |
setConfiguration(Map<String,? extends Object> configuration)
Pass component specific configuration parameters to the pipeline component in a generic way. |
Methods inherited from class org.apache.cocoon.sax.AbstractSAXProducer |
---|
getSAXConsumer, setConsumer, setSAXConsumer, toString |
Methods inherited from class org.apache.cocoon.pipeline.component.AbstractPipelineComponent |
---|
finish, setup |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.cocoon.pipeline.component.PipelineComponent |
---|
finish, setup |
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 CSVGenerator()
Create a new CSVGenerator
instance.
public CSVGenerator(String csv)
Method Detail |
---|
public void recycle()
public void setConfiguration(Map<String,? extends Object> configuration)
PipelineComponent
setConfiguration
in interface PipelineComponent
setConfiguration
in class AbstractPipelineComponent
configuration
- The Map
of configuration parameters.public void execute()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |