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

XMLBaseSAXHandler.h

Go to the documentation of this file.
00001 
00041 #ifndef _AMIRE_PERSISTENCE_XML_BASE_SAX_HANDLER_H
00042 #define _AMIRE_PERSISTENCE_XML_BASE_SAX_HANDLER_H
00043 
00044 #include <amire/property/Property.h>
00045 #include <amire/property/PropertyType.h>
00046 #include <amire/component/ComponentManager.h>
00047 #include <amire/persistence/XMLSpecializedSAXHandler.h>
00048 #include <amire/persistence/XMLBaseDictionary.h>
00049 #include <xercesc/sax2/DefaultHandler.hpp>
00050 #include <stack>
00051  
00052 namespace amire {
00053   namespace persistence {            
00054     class AMIRE_EXPORT_API XMLBaseSAXHandler : public DefaultHandler, public XMLBaseDictionary {
00055       private:
00056         enum HandlerState {
00057           root,
00058           propertyType,
00059           propertyValue,
00060           componentPrototype,
00061           composedComponentPrototype,
00062           component,
00063           dependencySequence,
00064           prototypeInitialisation,
00065           connectionSequence          
00066         };
00067         HandlerState state;  
00068         
00069         std::string currentLibraryName; 
00070         std::string libraryPathVariable;
00071         std::stack <amire::persistence::XMLSpecializedSAXHandler *> handlerStack;
00072         const std::vector<std::string> &preparseSchemaURIs;         
00073         
00074         amire::component::ComponentManager* componentManager;   
00075         // specialized handler
00076         amire::persistence::XMLSpecializedSAXHandler * specializedHandler;  
00077         // xml name constants
00078        
00079       public:   
00080         
00081         XMLBaseSAXHandler(amire::component::ComponentManager * aComponentManager,const std::vector<std::string>& somePreparseSchemaURIs);
00082         XMLBaseSAXHandler(const amire::persistence::XMLBaseSAXHandler& handler);             
00083         virtual ~XMLBaseSAXHandler();
00084         
00085         virtual void startElement (    
00086           const   XMLCh* const    uri,
00087           const   XMLCh* const    localname,
00088           const   XMLCh* const    qname,
00089           const   Attributes&     attrs    
00090         );    
00091         virtual void endElement(
00092                       const XMLCh* const uri,
00093                       const XMLCh* const localname,
00094                       const XMLCh* const qname
00095               );
00096               virtual void XMLBaseSAXHandler::characters(
00097                 const   XMLCh* const characters ,
00098                 const   unsigned int length); 
00099     
00100           
00101           amire::component::ComponentManager* getComponentManager();
00102         
00103         virtual void error(const SAXParseException& exception) {
00104           std::cout << "error occured" <<  XMLString::transcode(exception.getMessage())<< std::endl;
00105           throw exception;
00106         }
00107         virtual void warning(const SAXParseException& exception) {
00108         std::cout << "warning occured" <<  XMLString::transcode(exception.getMessage())<< std::endl;
00109           throw exception;
00110         }
00111 
00112         virtual void fatalError(const SAXParseException& exception) {
00113           std::cout << "fatal error ocurred: " << XMLString::transcode(exception.getMessage())<< std::endl;        
00114           throw exception;
00115         }
00116         
00117           void setLibraryPathVariable(std::string aLibraryPathVariable) {
00118           libraryPathVariable = aLibraryPathVariable;
00119         }
00120 
00121           std::string getLibraryPathVariable() const {
00122           return libraryPathVariable;
00123         }
00124 
00125 
00126         const std::string getCurrentLibraryName() const {
00127             return currentLibraryName;
00128           }
00129           
00130           void setCurrentLibraryName(const std::string aLibraryName) {
00131             currentLibraryName = aLibraryName;
00132           }
00133           
00134         const std::vector<std::string>& getPreparseSchemaURIs() const {
00135           return preparseSchemaURIs;
00136         }
00137 
00138           
00139     };    
00140   }
00141 }
00142 #endif

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