1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (c) 2008 The Regents of the University of California
4 //
5 // This file is part of Qbox
6 //
7 // Qbox is distributed under the terms of the GNU General Public License
8 // as published by the Free Software Foundation, either version 2 of
9 // the License, or (at your option) any later version.
10 // See the file COPYING in the root directory of this distribution
11 // or <http://www.gnu.org/licenses/>.
12 //
13 ////////////////////////////////////////////////////////////////////////////////
14 //
15 // StructureHandler.h
16 //
17 ////////////////////////////////////////////////////////////////////////////////
18 
19 #ifndef STRUCTUREHANDLER_H
20 #define STRUCTUREHANDLER_H
21 
22 #include <xercesc/util/XMLUniDefs.hpp>
23 #include <xercesc/sax2/Attributes.hpp>
24 #include <string>
25 using namespace xercesc;
26 
27 class StructureHandler
28 {
29   private:
30 
31   public:
32 
33   // Start of an element handled by the StructureHandler
34   virtual void startElement(const XMLCh* const uri,const XMLCh* const localname,
35       const XMLCh* const qname, const Attributes& attributes) = 0;
36 
37   // End of an element handled by the StructureHandler
38   virtual void endElement(const XMLCh* const uri, const XMLCh* const localname,
39       const XMLCh* const qname, std::string& content) = 0;
40 
41   // start a subhandler
42   virtual StructureHandler* startSubHandler(const XMLCh* const uri,
43     const XMLCh* const localname, const XMLCh* const qname,
44     const Attributes& attributes) = 0;
45 
46   // end a subhandler
47   virtual void endSubHandler(const XMLCh* const uri,
48     const XMLCh* const localname, const XMLCh* const qname,
49     const StructureHandler* const subHandler) = 0;
50 
StructureHandler()51   StructureHandler() {}
~StructureHandler()52   virtual ~StructureHandler() {}
53 };
54 #endif
55