00001 #ifndef __CXMLDocument__ 00002 #define __CXMLDocument__ 00003 00004 #include "CTextStream.hpp" 00005 #include "CXMLNode.hpp" 00006 using Exponent::IO::CTextStream; 00007 using Exponent::IO::CXMLNode; 00008 00009 namespace Exponent 00010 { 00011 namespace IO 00012 { 00105 class CXMLDocument : public CCountedObject 00106 { 00108 EXPONENT_CLASS_DECLARATION; 00111 // =========================================================================== 00112 00113 public: 00114 00115 // =========================================================================== 00116 00120 CXMLDocument(); 00121 00125 virtual ~CXMLDocument(); 00126 00127 // =========================================================================== 00128 00134 bool readFile(const CSystemString &filename); 00135 00141 bool writeFile(const CSystemString &filename); 00142 00143 // =========================================================================== 00144 00149 const CXMLNode *getRootNode() const; 00150 00155 CXMLNode *getMutableRootNode(); 00156 00161 void setRootNode(CXMLNode *root); 00162 00163 // =========================================================================== 00164 00165 protected: 00166 00167 // =========================================================================== 00168 00174 bool readDTD(CTextStream &stream); 00175 00182 bool processString(CString &string, CTextStream &stream); 00183 00184 // =========================================================================== 00185 00190 void outputDTD(CTextStream &stream); 00191 00196 void indentOutput(CTextStream &stream); 00197 00203 void outputNode(CXMLNode *node, CTextStream &stream); 00204 00205 // =========================================================================== 00206 00211 void replaceIllegalCharacters(CString &string); 00212 00217 void replaceEscapeCharacters(CString &string); 00218 00219 // =========================================================================== 00220 00221 CXMLNode *m_readNode; 00222 CXMLNode *m_rootNode; 00223 long m_indentLevel; 00224 }; 00225 } 00226 } 00227 00228 #endif // End of CXMLDocument.hpp