There are two components of a format plugin: a reader and a writer. We'll cover how to create both of these.

Format readers are simply classes that derive from ResourceReader. A ContentHandler is passed to such a class and the class does its job when ResourceReader::read() is called. By the time ResourceReader::process() is called, a ContentHandler pointer stored in m_contentHandler (you don't have to check for a NULL value, read() already does this). If something goes wrong you either fill m_error with your error and return, or throw SDX::Exception(SDX::Exception::ParseError, "Your description").

To simplify the process of reading text-based formats, the StreamReader class has been created. This class reads a file line by line and lets you process each line. Check out its API docs and look at the source of the StreamReaders - for ex. CsvStreamReader (headers, source) - included in SDX.

Format writers are descendants of the ContentHandler classes. You take care of opening any needed resources and hide this as much as possible from the user while keeping everything as flexible as possible.

To simplify the process of writing text-based formats, the StreamWriter class has been created. This class takes care of the opening of the stream so you only need to take care of the ContentHandler derived methods (startDocument, startNode, writeAttribute, etc). By the time any of these methods are called, you can write your content to the m_oStream variable (this is a pointer, so dereference it first). Check out its API docs and look at the source of the StreamWriters - for ex. CsvStreamWriter (headers, source) - included in SDX.

When you write a plugin for SDX, please contribute it and help the Open Source community!