};
//////////////////////////////////////////////////////////////////////////////////////////
-
-
- class sax_callback_sample
- {
- private:
- ::std::string m_indent;
- public:
- void start_xml_declaration()
- {
- printf("=XML Declaration : start=\n" );
- m_indent += " ";
- }
-
- void end_xml_declaration()
- {
- printf("=XML Declaration : end=\n\n" );
- m_indent = m_indent.substr(2);
- }
-
- void attribute( const sized_ccharbuf &attr_name, const sized_ccharbuf &attr_value )
- {
- printf("%sattr: %s=\"%s\"\n",
- m_indent.c_str(),
- attr_name.to_string().c_str(),
- attr_value.to_string().c_str() );
- }
-
- void comment( const sized_ccharbuf &s )
- {
- printf("%scomment: \"%s\"\n",
- m_indent.c_str(),
- s.to_string().c_str() );
- }
-
- void text( const sized_ccharbuf &s )
- {
- printf("%stext: \"%s\"\n",
- m_indent.c_str(),
- s.to_string().c_str() );
- }
- void start_element( const sized_ccharbuf &s )
- {
- printf("%s<elem: \"%s\"\n", m_indent.c_str(), s.to_string().c_str() );
- m_indent += " ";
- }
- void end_element(){
- m_indent = m_indent.substr(2);
- printf(" %send of element.\n%s>\n", m_indent.c_str(), m_indent.c_str());
- }
- };
-
- //////////////////////////////////////////////////////////////////////////////////////////
-
- class reverse_sax_parser_impl
- {
- protected:
- int m_code;
- const char* m_work_str1;
-
- protected:
- void _poped_setup(int code, const char* work_str1)
- {
- m_code = code;
- m_work_str1 = work_str1;
- }
- virtual void pop() =0;
-
- public:
- reverse_sax_parser_impl(){
- m_code = rule::pcode::_null;
- m_work_str1 = NULL;
-
- //pop();
- }
-
- //const char* get_string()
- const char* pop_string()
- {
- const char* p = m_work_str1;
- pop();
- return p;
- }
-
- bool operator << (int n)
- {
- return ( n == m_code );
- }
- };
}
}