#include <SDXCSVStreamReader.h>
Public Member Functions | |
CsvStreamReader (std::istream *iStream=0, SDX::ContentHandler *contentHandler=0) | |
Constructor. | |
void | setFieldNames (std::vector< std::string > fieldNames) |
Set the names of the fields in CSV stream. | |
void | setRowName (std::string rowName) |
Set the name of a row in CSV stream. |
In CSV (Comma Seperated Values) file, each row represents a node, and subnodes are seperated by comma's:
name,company,address Bob 'o Reilly,The test company,Foo lane 83 Kent Brockman,Another test company,Bar avenue 57For that file, the following events will get sent to the ContentHandler:
contentHandler->startDocument(); contentHandler->startNode("customer"); contentHandler->writeNode("name", "Bob 'o Reily"); contentHandler->writeNode("company", "The test company"); contentHandler->writeNode("address", "Foo lane 83"); contentHandler->endNode(); contentHandler->startNode("customer"); contentHandler->writeNode("name", "Kent Brockman"); contentHandler->writeNode("company", "Another test company"); contentHandler->writeNode("address", "Bar avenue 57"); contentHandler->endNode(); contentHandler->endDocument();The name of a row can be set with setRowName(). The field names are either extracted from the first row or set with the setFieldNames() method. For any field who's name is unknown the node name will be "Unknown".
Definition at line 36 of file SDXCSVStreamReader.h.