diff --git a/src/dawnshared/util/Xml.hpp b/src/dawnshared/util/Xml.hpp index 02849cd2..0b9f085a 100644 --- a/src/dawnshared/util/Xml.hpp +++ b/src/dawnshared/util/Xml.hpp @@ -33,6 +33,9 @@ namespace Dawn { protected: static bool_t isWhitespace(char_t c); + // @deprecated + std::vector children; + public: static Xml load(std::string data); static void load(Xml *xml, std::string data, size_t *j); @@ -43,9 +46,6 @@ namespace Dawn { std::string textContent; std::map attributes; std::vector childNodes; - - // @deprecated - std::vector children; std::vector getChildrenOfType(std::string type); Xml * getFirstChildOfType(std::string type); diff --git a/src/dawntools/util/parser/SceneItemParser.cpp b/src/dawntools/util/parser/SceneItemParser.cpp index 44fe784a..9e971350 100644 --- a/src/dawntools/util/parser/SceneItemParser.cpp +++ b/src/dawntools/util/parser/SceneItemParser.cpp @@ -56,10 +56,15 @@ int32_t SceneItemParser::onParse( struct SceneItemDependency dep; - auto itChildren = node->children.begin(); - while(itChildren != node->children.end()) { + auto itChildren = node->childNodes.begin(); + while(itChildren != node->childNodes.end()) { + if(itChildren->nodeType != XML_NODE_TYPE_ELEMENT) { + ++itChildren; + continue; + } + // Parse child nodes, they may be components or not - auto c = *itChildren; + auto c = itChildren->child; if(c->node == "child" || c->node == "item") { struct SceneItem child; diff --git a/src/dawntools/util/parser/SceneParser.cpp b/src/dawntools/util/parser/SceneParser.cpp index b7ad347b..578575a6 100644 --- a/src/dawntools/util/parser/SceneParser.cpp +++ b/src/dawntools/util/parser/SceneParser.cpp @@ -32,9 +32,14 @@ int32_t SceneParser::onParse( struct SceneItemDependency dep; //Parse the children - auto itChildren = node->children.begin(); - while(itChildren != node->children.end()) { - Xml *child = *itChildren; + auto itChildren = node->childNodes.begin(); + while(itChildren != node->childNodes.end()) { + if(itChildren->nodeType != XML_NODE_TYPE_ELEMENT) { + ++itChildren; + continue; + } + + Xml *child = itChildren->child; if(child->node == "asset") { struct SceneAsset asset; diff --git a/src/dawntools/vnscenetool/VNSceneParser.cpp b/src/dawntools/vnscenetool/VNSceneParser.cpp index 94e3fe7e..d1043dbb 100644 --- a/src/dawntools/vnscenetool/VNSceneParser.cpp +++ b/src/dawntools/vnscenetool/VNSceneParser.cpp @@ -29,9 +29,14 @@ int32_t VNSceneParser::onParse( if(ret != 0) return ret; // Now pass the VN Events - auto itChildren = node->children.begin(); - while(itChildren != node->children.end()) { - Xml *child = *itChildren; + auto itChildren = node->childNodes.begin(); + while(itChildren != node->childNodes.end()) { + if(itChildren->nodeType != XML_NODE_TYPE_ELEMENT) { + ++itChildren; + continue; + } + + Xml *child = itChildren->child; if(child->node != "events") { ++itChildren; continue; diff --git a/src/dawntools/vnscenetool/events/VNChoiceEventParser.cpp b/src/dawntools/vnscenetool/events/VNChoiceEventParser.cpp index 470f9f51..1bfda236 100644 --- a/src/dawntools/vnscenetool/events/VNChoiceEventParser.cpp +++ b/src/dawntools/vnscenetool/events/VNChoiceEventParser.cpp @@ -22,9 +22,14 @@ int32_t VNChoiceParser::onParse( std::string *error ) { int32_t ret; - auto itChildren = node->children.begin(); - while(itChildren != node->children.end()) { - Xml *child = *itChildren; + auto itChildren = node->childNodes.begin(); + while(itChildren != node->childNodes.end()) { + if(itChildren->nodeType != XML_NODE_TYPE_ELEMENT) { + ++itChildren; + continue; + } + + Xml *child = itChildren->child; // Parse strings if(child->node == "string") { @@ -61,16 +66,26 @@ int32_t VNChoicesEventParser::onParse( std::string *error ) { int32_t ret; - auto itChildren = node->children.begin(); - while(itChildren != node->children.end()) { - Xml *child = *itChildren; + auto itChildren = node->childNodes.begin(); + while(itChildren != node->childNodes.end()) { + if(itChildren->nodeType != XML_NODE_TYPE_ELEMENT) { + ++itChildren; + continue; + } + + Xml *child = itChildren->child; // Parse strings if(child->node == "title") { - auto itChildren2 = child->children.begin(); - while(itChildren2 != child->children.end()) { + auto itChildren2 = child->childNodes.begin(); + while(itChildren2 != child->childNodes.end()) { + if(itChildren2->nodeType != XML_NODE_TYPE_ELEMENT) { + ++itChildren2; + continue; + } + VNText text; - ret = (VNTextParser()).parse(*itChildren2, &text, error); + ret = (VNTextParser()).parse(itChildren2->child, &text, error); if(ret != 0) return ret; out->titles.push_back(text); ++itChildren2; diff --git a/src/dawntools/vnscenetool/events/VNSceneEventsParser.cpp b/src/dawntools/vnscenetool/events/VNSceneEventsParser.cpp index 456da5fc..7ef5c08b 100644 --- a/src/dawntools/vnscenetool/events/VNSceneEventsParser.cpp +++ b/src/dawntools/vnscenetool/events/VNSceneEventsParser.cpp @@ -24,9 +24,14 @@ int32_t VNSceneEventsParser::onParse( ) { int32_t ret; - auto itChildren = node->children.begin(); - while(itChildren != node->children.end()) { - Xml *child = *itChildren; + auto itChildren = node->childNodes.begin(); + while(itChildren != node->childNodes.end()) { + if(itChildren->nodeType != XML_NODE_TYPE_ELEMENT) { + ++itChildren; + continue; + } + + Xml *child = itChildren->child; struct VNSceneEvent event; // Parse event(s) diff --git a/src/dawntools/vnscenetool/events/VNTextEventParser.cpp b/src/dawntools/vnscenetool/events/VNTextEventParser.cpp index f1d05a2e..203bfdd2 100644 --- a/src/dawntools/vnscenetool/events/VNTextEventParser.cpp +++ b/src/dawntools/vnscenetool/events/VNTextEventParser.cpp @@ -47,9 +47,14 @@ int32_t VNTextEventParser::onParse( std::string *error ) { int32_t ret; - auto itChildren = node->children.begin(); - while(itChildren != node->children.end()) { - Xml *child = *itChildren; + auto itChildren = node->childNodes.begin(); + while(itChildren != node->childNodes.end()) { + if(itChildren->nodeType != XML_NODE_TYPE_ELEMENT) { + ++itChildren; + continue; + } + + Xml *child = itChildren->child; // Parse strings if(child->node == "string") {