1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef I_XML_PARSER_EVENT_HANDLER_HXX_INCLUDED
25 #define I_XML_PARSER_EVENT_HANDLER_HXX_INCLUDED
26 
27 #include <string>
28 #include <map>
29 
30 #if defined(XML_UNICODE) || defined(XML_UNICODE_WCHAR_T)
31 	typedef std::wstring string_t;
32 	typedef wchar_t char_t;
33 #else
34 	typedef std::string string_t;
35 	typedef char char_t;
36 #endif
37 
38 // name-value container
39 typedef std::map<string_t, string_t> xml_tag_attribute_container_t;
40 
41 
42 //#########################################
43 class i_xml_parser_event_handler
44 {
45 public:
~i_xml_parser_event_handler()46 	virtual ~i_xml_parser_event_handler() {};
47 
48 	virtual void start_document() = 0;
49 
50 	virtual void end_document() = 0;
51 
52 	virtual void start_element(
53 		const string_t& raw_name,
54 		const string_t& local_name,
55 		const xml_tag_attribute_container_t& attributes) = 0;
56 
57 	virtual void end_element(
58 		const string_t& raw_name,
59 		const string_t& local_name) = 0;
60 
61 	virtual void characters(
62 		const string_t& character) = 0;
63 
64 	virtual void ignore_whitespace(
65 		const string_t& whitespaces) = 0;
66 
67 	virtual void processing_instruction(
68 		const string_t& target, const string_t& data) = 0;
69 
70 	virtual void comment(const string_t& comment) = 0;
71 };
72 
73 #endif
74 
75