///Предварительный разбор void Prepare (const ParseNode& decl) { for (Parser::Iterator iter=decl.First (); iter; ++iter) { try { ParseNode decl = *iter; const char* type = decl.Name (); ParserMap::iterator iter = parsers.find (type); if (iter == parsers.end () || !iter->second.prepare_handler) continue; //игнорирование неизвестных узлов iter->second.prepare_handler (decl); } catch (common::ParserException&) { //игнорирование, протоколирование уже произведено } catch (std::exception& e) { root.Log ().Error (*iter, "%s", e.what ()); } catch (...) { root.Log ().Error (*iter, "unknown exception"); } } prepared = true; }
void dump (const ParseNode& node) { printf ("%s {", node.Name ()); for (size_t i=0, count=node.AttributesCount (); i<count; i++) { if (i) printf (", "); printf ("%s", node.Attribute (i)); } printf ("}\n"); }
void XmlSceneParser::Parse (const ParseNode& decl, Node& parent, SceneContext& context) { try { for (Parser::Iterator iter=decl.First (); iter; ++iter) { try { ParseNode decl = *iter; const char* type = decl.Name (); Impl::ParserMap::iterator iter = impl->parsers.find (type); if (iter == impl->parsers.end () || !iter->second.parse_handler) continue; //игнорирование неизвестных узлов iter->second.parse_handler (decl, parent, context); } catch (std::exception& e) { if (!context.FilterError (e.what ())) throw; print_log (context.LogHandler (), e.what ()); } catch (...) { static const char* ERROR_STRING = "unknown exception"; if (!context.FilterError (ERROR_STRING)) throw; print_log (context.LogHandler (), ERROR_STRING); } } } catch (xtl::exception& e) { e.touch ("scene_graph::XmlSceneParser::ParseDispatch"); throw; } }
void f (const ParseNode& node) { printf ("node '%s': source='%s' line=%lu\n", node.Name (), node.Source (), node.LineNumber ()); throw TestException (); }