/* * XMLWriter.hh * * Created on: 7 août 2013 * Author: CS */ #ifndef XMLWRITER_HH_ #define XMLWRITER_HH_ #include "AbstractWriter.hh" #include namespace TimeTableCatalog { class XMLWriter: public TimeTableCatalog::AbstractWriter { public: XMLWriter(const std::string& pPath, const std::string& pName = NULL); virtual ~XMLWriter(); /** * Writes TimeTable into an InternalXML formated file. */ std::string write(const TimeTable& pTT, const char* pEncoding); protected: /** * Writes value. */ void writeElement(const TimeTable& pTT, xmlTextWriterPtr& pWriter, std::string pTag, const std::string &pValue, const char* pEncoding = "UTF-8"); /** * Writes a start tag. */ void openTag(const TimeTable& pTT, xmlTextWriterPtr& pWriter, std::string pTag); /** * Adds an attribute to the current tag. */ void addAttribute(const TimeTable& pTT, xmlTextWriterPtr& pWriter, std::string pTag, const std::string &pValue, const char* pEncoding = "UTF-8"); /** * Writes a stop tag. */ void closeTag(const TimeTable& pTT, xmlTextWriterPtr& pWriter, std::string pTag); /** * Converts, just in case, input into UTF-8. */ xmlChar * convertInput(const TimeTable& pTT, const char* pIn, const char* pEncoding); void logEndTagError(const std::string& ptag, const std::string& pTTPath); void logStartTagError(const std::string& ptag, const std::string& pTTPath); void logTagError(const std::string& ptag, const std::string& pTTPath); void logAttributeError(const std::string& pAttribute, const std::string& pTTPath); }; } /* namespace TimeTableCatalog */ #endif /* XMLWRITER_HH_ */