8 #ifndef INCLUDED_ORCUS_SAX_PARSER_BASE_HPP
9 #define INCLUDED_ORCUS_SAX_PARSER_BASE_HPP
12 #include "pstring.hpp"
13 #include "cell_buffer.hpp"
14 #include "parser_global.hpp"
15 #include "parser_base.hpp"
23 #define ORCUS_DEBUG_SAX_PARSER 0
25 #if ORCUS_DEBUG_SAX_PARSER
31 namespace orcus {
namespace sax {
47 enum class keyword_type { dtd_public, dtd_private };
66 ORCUS_PSR_DLLPUBLIC
char decode_xml_encoded_char(
const char* p,
size_t n);
76 const char* begin_pos;
98 std::unique_ptr<impl> mp_impl;
106 bool m_root_elem_open:1;
119 void nest_up() { ++m_nest_level; }
122 assert(m_nest_level > 0);
126 void inc_buffer_pos();
127 void reset_buffer_pos() { m_buffer_pos = 0; }
129 void has_char_throw(
const char* msg)
const
144 #if ORCUS_DEBUG_SAX_PARSER
145 if (mp_char >= mp_end)
148 return mp_end - mp_char;
151 char cur_char_checked()
const
162 #if ORCUS_DEBUG_SAX_PARSER
163 if (mp_char >= mp_end)
164 throw malformed_xml_error(
"xml stream ended prematurely.", offset());
169 char next_char_checked()
173 throw malformed_xml_error(
"xml stream ended prematurely.", offset());
178 cell_buffer& get_cell_buffer();
188 void expects_next(
const char* p,
size_t n);
190 void parse_encoded_char(cell_buffer& buf);
191 void value_with_encoded_char(cell_buffer& buf, pstring& str);
201 bool value(pstring& str,
bool decode);
203 void name(pstring& str);
204 void element_name(parser_element& elem,
const char* begin_pos);
205 void attribute_name(pstring& attr_ns, pstring& attr_name);
206 void characters_with_encoded_char(cell_buffer& buf);
Definition: pstring.hpp:24
Definition: sax_parser_base.hpp:87
Definition: parser_base.hpp:34
Definition: sax_parser_base.hpp:72
Definition: sax_parser_base.hpp:45
size_t remains() const
Definition: sax_parser_base.hpp:142
Definition: parser_base.hpp:20
Definition: base64.hpp:15
Definition: sax_parser_base.hpp:95