|
OpenADFortTk (basic)
|
00001 #ifndef XAIF_SAXhandler_INCLUDED_h 00002 #define XAIF_SAXHandler_INCLUDED_h 00003 00004 #include <stack> 00005 00006 #include <xercesc/util/XercesDefs.hpp> 00007 #include <xercesc/util/PlatformUtils.hpp> 00008 00009 #include <xercesc/dom/DOM.hpp> 00010 00011 #include <xercesc/sax2/Attributes.hpp> 00012 #include <xercesc/sax2/DefaultHandler.hpp> 00013 #include <xercesc/sax2/SAX2XMLReader.hpp> 00014 00015 #include "PUXlationContext.h" 00016 00017 namespace xaif2whirl { 00018 00019 class XAIF_SAXHandler : public xercesc::DefaultHandler { 00020 00021 public: 00022 00023 XAIF_SAXHandler(PU_Info* pu_forest, const XMLCh* implementationFeatures); 00024 ~XAIF_SAXHandler(); 00025 00026 void initialize(bool validateAgainstSchema); 00027 00028 void parse(std::string theXMLFileName); 00029 00030 void startElement(const XMLCh* const uri, 00031 const XMLCh* const localname, 00032 const XMLCh* const qname, 00033 const xercesc::Attributes& attrs); 00034 00035 void endElement(const XMLCh* const uri, 00036 const XMLCh* const localname, 00037 const XMLCh* const qname); 00038 00039 bool getParserErrorStatus(); 00040 00041 void deleteParser(); 00042 00043 private: 00044 00048 XAIF_SAXHandler(); 00049 00053 XAIF_SAXHandler& operator=(const XAIF_SAXHandler& x); 00054 00055 PU_Info* myPUForest_p; 00056 00057 PUXlationContext myPUXlationContext; 00058 00059 xercesc::SAX2XMLReader* myParser_p; 00060 00061 xercesc::DOMImplementation* myDOMImplementation_p; 00062 00063 xercesc::DOMDocument* myDOMDocument_p; 00064 00065 std::stack<xercesc::DOMElement*> myElementStack; 00066 00067 bool inDOMMode; 00068 00069 void copyAttributes(xercesc::DOMElement* theElement, const xercesc::Attributes& theAttributes); 00070 00071 }; // end class XAIF_SAXHandler 00072 00073 } // end namespace xaif2whirl 00074 00075 #endif