From: Myun2 Date: Sun, 19 Dec 2010 08:34:52 +0000 (+0900) Subject: rule_xml.hpp: 101112_dom3\6_root_cant_have_text_exception への分岐対応 X-Git-Tag: 20111130_shapeup_prev~42^2~33 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=e68e053260bf0bb8897e838cd3d556c329d41657;p=roast%2Froast.git rule_xml.hpp: 101112_dom3\6_root_cant_have_text_exception への分岐対応 --- diff --git a/roast/include/roast/xml/roast_xml/rule_xml.hpp b/roast/include/roast/xml/roast_xml/rule_xml.hpp index e94d90cf..0c781250 100644 --- a/roast/include/roast/xml/roast_xml/rule_xml.hpp +++ b/roast/include/roast/xml/roast_xml/rule_xml.hpp @@ -114,7 +114,7 @@ namespace roast not_angle_bracket_start_exception() : xml_parse_exception("Not angle bracket start.") {} }; struct root_cant_have_text_exception : public xml_parse_exception{ - root_cant_have_text_exception() : xml_parse_exception("Root can't have text.") {} }; + root_cant_have_text_exception() : xml_parse_exception("The text cannot be included top-level.") {} };//do not include a top level of the text. struct processing_instruction_end_invalid : public xml_parse_exception{ processing_instruction_end_invalid() : xml_parse_exception("The end of processing_instruction should be \"?>\"") {} }; diff --git a/roast/include/roast/xml/roast_xml/sax.hpp b/roast/include/roast/xml/roast_xml/sax.hpp index 5178beac..809467f7 100644 --- a/roast/include/roast/xml/roast_xml/sax.hpp +++ b/roast/include/roast/xml/roast_xml/sax.hpp @@ -154,8 +154,17 @@ namespace roast } template - void operator << (const rule::error_event<_EvtCode>& evt) + /*__forceinline*/ void operator << (const rule::error_event<_EvtCode>& evt) { + using namespace rule; + + if ( _EvtCode == pcode::not_angle_bracket_start ) + { + //if ( m_code == rule::pcode::_null ) + if ( _ValidateCheck ) + if ( m_element_name_stack.size() == 0 ) + throw rule::root_cant_have_text_exception(); + } throw typename rule::error_event_to_exception<_EvtCode>::type(); } };