// invalid termination.
_error_code_invalid_term = 0x8200,
+ illegal_term,
invalid_term_in_comment,
invalid_term_in_processing_instruction,
invalid_term_in_attrname,
///
- struct comment_invalid_start : public xml_parse_exception{
- comment_invalid_start() : xml_parse_exception("Comment Format Invalid. (Need Start \"<!--\")") {} };
+ struct invalid_comment_start_exception : public xml_parse_exception{
+ invalid_comment_start_exception() : xml_parse_exception("Comment Format Invalid. (Need Start \"<!--\")") {} };
- struct comment_invalid_term : public xml_parse_exception{
- comment_invalid_term() : xml_parse_exception("Comment was not closed.") {} };
+ struct invalid_term_in_comment_exception : public xml_parse_exception{
+ invalid_term_in_comment_exception() : xml_parse_exception("Comment was not closed.") {} };
- struct comment_invalid_end : public xml_parse_exception{
- comment_invalid_end() : xml_parse_exception("The thing including \"--\" cannot be done in the Comment except the terminal.") {} };
+ struct invalid_comment_end_exception : public xml_parse_exception{
+ invalid_comment_end_exception() : xml_parse_exception("The thing including \"--\" cannot be done in the Comment except the terminal.") {} };
template <int _EvtCode>
struct error_event_to_exception { typedef xml_parse_exception type; };
template <>
struct error_event_to_exception<pcode::not_angle_bracket_start> { typedef not_angle_bracket_start_exception type; };
template <>
- struct error_event_to_exception<pcode::root_cant_have_text> { typedef root_cant_have_text_exception type; };
+ struct error_event_to_exception<pcode::invalid_comment_start> { typedef invalid_comment_start_exception type; };
+ template <>
+ struct error_event_to_exception<pcode::invalid_comment_end> { typedef invalid_comment_end_exception type; };
//////////////////////////////////////////////////
rule::body, // XML Body
comments_and_whitespaces, // Comments and Whitespaces
zeroterm
+ > _rule_1;
+
+ typedef exception_to_event<
+ _rule_1,
+ eoi_exception,
+ error_event<pcode::illegal_term>
> _rule;
}
// root_cant_have_text
sax_error_test(" a", root_cant_have_text_exception().c_str() );
+ sax_error_test(" <! ", invalid_comment_start_exception().c_str() );
+ sax_error_test(" <!- ", invalid_comment_start_exception().c_str() );
+ sax_error_test(" <!-> ", invalid_comment_start_exception().c_str() );
+ sax_error_test(" <!--> ", invalid_comment_start_exception().c_str() );
+ sax_error_test(" <!--- ", invalid_comment_end_exception().c_str() );
+ sax_error_test(" <!---> ", invalid_term_in_comment_exception().c_str() );
+ sax_error_test(" <!----> ", invalid_comment_end_exception().c_str() );
+ sax_error_test(" <!-- --> ", invalid_term_in_comment_exception().c_str() );
+ sax_error_test(" <!-- -- ", invalid_comment_end_exception().c_str() );
}
catch(sax_exception& e)
{