Fixed XML Parser not parsing empty XML sheets 100% correctly.

This commit is contained in:
2023-05-20 22:53:53 -07:00
parent f8ca5f2e17
commit a64df032e2
7 changed files with 17 additions and 94 deletions

View File

@ -40,11 +40,16 @@ void Xml::load(Xml *xml, std::string data, size_t *j) {
doing = XML_PARSE_STATE_PARSING_COMMENT;
i += 3;
} else if(insideTag) {
i -= 1;
auto child = new Xml();
Xml::load(child, data, &i);
xml->children.push_back(child);
doing = XML_PARSE_STATE_PARSING_CHILD;
if(data[i] == '/') {
i -= 1;
doing = XML_PARSE_STATE_PARSING_CHILD;
} else {
i -= 1;
auto child = new Xml();
Xml::load(child, data, &i);
xml->children.push_back(child);
doing = XML_PARSE_STATE_PARSING_CHILD;
}
} else {
doing = XML_PARSE_STATE_PARSING_TAG_NAME;
level++;