00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef INC_SAX2Wrapper_hpp_
00026 #define INC_SAX2Wrapper_hpp_ 1
00027
00028 #include <iostream>
00029 #include <fstream>
00030 #include <cstdlib>
00031
00032 #include "UAP/BasicUtilities.hpp"
00033 #include "UAP/UAPNode.hpp"
00034
00035 #include <xercesc/sax2/DefaultHandler.hpp>
00036
00037 XERCES_CPP_NAMESPACE_USE
00038
00045 class SAX2Wrapper : private DefaultHandler {
00046 public:
00047
00050 SAX2Wrapper() {};
00051
00054 ~SAX2Wrapper() {};
00055
00069 bool XMLFileToUAPRep (const std::string& file_name, UAPNode* root, bool convert = true);
00070
00071 private:
00072
00073
00074
00075
00076
00077 void endDocument();
00078
00079 void endElement( const XMLCh* const uri,
00080 const XMLCh* const localname,
00081 const XMLCh* const qname);
00082
00083 void characters(const XMLCh* const chars, const unsigned int length);
00084
00085 void ignorableWhitespace (
00086 const XMLCh* const chars,
00087 const unsigned int length);
00088
00089 void processingInstruction (
00090 const XMLCh* const target,
00091 const XMLCh* const data);
00092
00093 void startDocument();
00094
00095 void startElement( const XMLCh* const uri,
00096 const XMLCh* const localname,
00097 const XMLCh* const qname,
00098 const Attributes& attributes);
00099
00100
00101
00102
00103
00104 void warning(const SAXParseException& exc);
00105 void error(const SAXParseException& exc);
00106 void fatalError(const SAXParseException& exc);
00107
00108
00109
00110 bool parse_OK;
00111 bool finished;
00112 bool convert_entities;
00113 UAPNode* this_root;
00114 UAPNode* current;
00115
00116 std::string StrX(const XMLCh* const toTranscode);
00117 void error_out (const std::string& err_type, const SAXParseException& e);
00118
00119 };
00120
00121 #endif