OSDN Git Service

rule_xml.hpp: 101112_dom3\6_root_cant_have_text_exception への分岐対応
authorMyun2 <myun2@nwhite.info>
Sun, 19 Dec 2010 08:34:52 +0000 (17:34 +0900)
committerMyun2 <myun2@nwhite.info>
Sun, 19 Dec 2010 08:35:43 +0000 (17:35 +0900)
roast/include/roast/xml/roast_xml/rule_xml.hpp
roast/include/roast/xml/roast_xml/sax.hpp

index e94d90c..0c78125 100644 (file)
@@ -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 \"?>\"") {} };
index 5178bea..809467f 100644 (file)
@@ -154,8 +154,17 @@ namespace roast
                        }
 
                        template <int _EvtCode>
-                       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();
                        }
                };