Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

XMLComponentManagerWriter.h

Go to the documentation of this file.
00001 
00033 #ifndef _AMIRE_PERSISTENCE_XML_COMPONENT_MANAGER_WRITER_H
00034 #define _AMIRE_PERSISTENCE_XML_COMPONENT_MANAGER_WRITER_H
00035 
00036 
00037 #include <amire/common/DllSupport.h>
00038 #include <amire/component/ComponentManager.h>
00039 #include <amire/component/ComponentManagerWriter.h>
00040 #include <amire/persistence/XMLBaseDOMCreator.h>
00041 #include <xercesc/sax2/DefaultHandler.hpp>
00042 #include <xercesc/sax/SAXParseException.hpp>
00043 namespace amire {
00044   namespace persistence {  
00049     class XMLAmireDomErrorHandler;
00050     
00051     class AMIRE_EXPORT_API XMLComponentManagerWriter {
00052     private:
00053       XercesDOMParser * parser;
00054       std::string fileName;
00055       std::string schemaURI;
00056       std::string templateFileDirectory;
00057       bool writeSchemaAttribute;
00058       
00059     public:      
00060       XMLComponentManagerWriter::XMLComponentManagerWriter(const std::string & aFileName);
00061             
00062       virtual ~XMLComponentManagerWriter();
00063 
00064 
00069       virtual void write(const amire::component::ComponentManager *componentManager);
00070 
00075       virtual void writeApplication(const amire::component::ComponentManager *componentManager);
00076 
00081       virtual void writeLibrary(const amire::component::ComponentManager *componentManager);      
00082       
00083       void setFileName(const std::string &aFileName) {
00084         fileName = aFileName;
00085       }
00086 
00087       const std::string &getFileName() const {
00088         return fileName;
00089       }
00090       
00091       
00092       void parseSchema(const std::string aSchemaURI); 
00093       
00094       void writeSchemaURIAttribute(bool writeSchemaAttribute) {
00095         this->writeSchemaAttribute = writeSchemaAttribute;
00096       }
00097 
00098       void setTemplateFileDirectory(const std::string &aTemplateFileDirectory) {
00099         templateFileDirectory = aTemplateFileDirectory;
00100       }
00101 
00102       const std::string &getTemplateFileDirectory() const {
00103         return templateFileDirectory;
00104       }
00105 
00106                           
00107       private: 
00108         void initXMLEnvironment();
00109         void initParser();
00110         void terminateXMLEnvironment();
00111     };
00112     
00113     
00114     class XMLAmireDOMErrorHandler: public DefaultHandler {
00115       
00116       virtual void warning(const SAXParseException& exception) {
00117        std::cout << "Warning message is: \n" << XMLString::transcode(exception.getMessage()) << "\n"<<std::endl;
00118      
00119       }
00120  
00121       virtual void error(const SAXParseException& exception) {
00122        std::cout << "Error message is: \n" << XMLString::transcode(exception.getMessage()) << "\n"<<std::endl;
00123       
00124       }
00125  
00126       virtual void fatalError(const SAXParseException& exception) {
00127        std::cout << "FatalError message is: \n" << XMLString::transcode(exception.getMessage()) << "\n"<<std::endl;
00128       };
00129  
00130       virtual void resetErrors() {
00131        };    
00132      };
00133     
00134   }
00135 }
00136 
00137 #endif

Generated on Tue May 20 17:23:54 2003 for AMIRE-Framework by doxygen1.3