|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.xbus.protocol.csv.CSVParser
public class CSVParser
The CSVParser
class contains all methods necessary for parsing
CSV format into an XML representation.
This parser supports all CSV format content which satisfies the rules indicated in this CSV definition .
The parsing result is a DOM tree with the following structure:
<InterfaceName>
The header is optional. For every entry a Record tag structure is created.
The information for the names and values of the DOM entities are taken out of the CSV source text and the optional Description file. A description file must be valid (InterfaceSpecCSV.dtd).
The following table gives an overview, how the Header information and the names of the entry tags are selected:
CSV file | Description file | Result | ||||||
has header | does not contain header | No description file | does not contain any information | contains only Header information | contains only Records information | contains Header and Records information | Header information taken from: | Tag names of entries taken from: |
X | X | CSV header | CSV header | |||||
X | X | CSV header | CSV header | |||||
X | X | Description file | Header information in description file | |||||
X | X | CSV header | Records information in description file | |||||
X | X | Description file | Records information in description file | |||||
X | X | No header | Tag name = "field" | |||||
X | X | No header | Tag name = "field" | |||||
X | X | Description file | Header information in description file | |||||
X | X | No header | Records information in description file | |||||
X | X | Description file | Records information in description file |
Constructor Summary | |
---|---|
CSVParser(java.lang.String system)
Constructor of the parser. |
Method Summary | |
---|---|
org.w3c.dom.Document |
getDescriptionTree()
|
java.util.Vector |
getFieldNames()
|
java.lang.String |
getFieldSeparator()
|
protected static CSVParser |
getInstance(java.lang.String sourceType)
Returns an instance of CSVParser |
java.lang.String |
getLineSeparator()
|
java.lang.String |
getQuoteChar()
|
boolean |
isHasHeader()
|
org.w3c.dom.Document |
parse(java.lang.String text,
java.lang.String systemName)
Parses the passed CSV format text into a DOM tree and returns it. |
void |
setDescriptionTree(org.w3c.dom.Document descriptionTree)
|
void |
setFieldNames(java.util.Vector fieldNames)
|
void |
setFieldSeparator(java.lang.String fieldSeparator)
|
void |
setHasHeader(boolean hasHeader)
|
void |
setLineSeparator(java.lang.String lineSeparator)
|
void |
setQuoteChar(java.lang.String quoteChar)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CSVParser(java.lang.String system) throws XException
system
- the name of the process
XException
Method Detail |
---|
public void setQuoteChar(java.lang.String quoteChar)
quoteChar
- The quoteChar to set.public java.lang.String getQuoteChar()
public boolean isHasHeader()
public void setHasHeader(boolean hasHeader)
hasHeader
- The hasHeader to set.public void setFieldSeparator(java.lang.String fieldSeparator)
fieldSeparator
- The fieldSeparator to set.public java.lang.String getFieldSeparator()
public void setLineSeparator(java.lang.String lineSeparator)
lineSeparator
- The lineSeparator to set.public java.lang.String getLineSeparator()
public org.w3c.dom.Document getDescriptionTree()
public void setDescriptionTree(org.w3c.dom.Document descriptionTree)
descriptionTree
- The descriptionTree to set.public java.util.Vector getFieldNames()
public void setFieldNames(java.util.Vector fieldNames)
fieldNames
- protected static CSVParser getInstance(java.lang.String sourceType) throws XException
CSVParser
sourceType
- The name of the process
XException
public org.w3c.dom.Document parse(java.lang.String text, java.lang.String systemName) throws XException
text
- The source text to parse. Has to be CSV format.systemName
- The name of the process - used as root tag
XException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |