00001 /* libIXAml - IXA Taldea */ 00002 00003 #ifndef _XMLSIMPLEDOC_H 00004 #define _XMLSIMPLEDOC_H 00005 00006 #include <string> 00007 #include <fstream> 00008 #include "teiheader.h" 00009 #include "xmlsimplestruct.h" 00010 00014 class XMLSimpleDoc { 00015 00016 protected: 00017 00018 ValidationMode validationMode; 00019 EncodingType workingEncoding; 00020 EncodingType outputEncoding; 00021 TEIHeader teiHeader; 00023 public: 00024 00026 XMLSimpleDoc(); 00027 00031 XMLSimpleDoc(const XMLSimpleDoc & xsd); 00032 00036 ValidationMode getValidationMode() const; 00037 00041 EncodingType getWorkingEncoding() const; 00042 00046 EncodingType getOutputEncoding() const; 00047 00051 TEIHeader getTEIHeader() const; 00052 00056 void putValidationMode(ValidationMode vm); 00057 00061 void putWorkingEncoding(EncodingType enc); 00062 00066 void putOutputEncoding(EncodingType enc); 00067 00071 void putTEIHeader(const TEIHeader & teiH); 00072 00074 void write() const throw (char*); 00075 00079 void write( const std::string & fname) const throw (char*); 00080 00084 void write( std::ostream & file) const throw (char*); 00085 00089 void writeToCompressedFile( const std::string & fname ) const throw (char*); 00090 00094 std::string writeToString() const throw (char*); 00095 00099 void read( const std::string & fname) throw(char*); 00100 00104 void read( std::istream & file) throw (char*); 00105 00109 void readFromString( const std::string & inputstr) throw (char*); 00110 00112 virtual ~XMLSimpleDoc(); 00113 00118 static std::string erasePath(const std::string & str); 00119 00120 protected: 00121 00125 virtual void writeDocument(XMLSimpleStruct* xss) const throw (char*) = 0; 00126 00130 virtual void readDocument(XMLSimpleStruct* xss) throw (char*) = 0; 00131 00132 }; 00133 00134 #endif //_XMLSIMPLEDOC_H