SDX::Formats::CsvStreamReader Class Reference

Class that reads CSV from a stream. More...

#include <SDXCSVStreamReader.h>

Inheritance diagram for SDX::Formats::CsvStreamReader:

SDX::Helpers::StreamReader SDX::ResourceReader

List of all members.

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.


Detailed Description

Class that reads CSV from a 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 57
 
For 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.


The documentation for this class was generated from the following files:

Generated on Mon Apr 27 16:55:49 2009 for SDX by  doxygen 1.5.8