Skip to content
Snippets Groups Projects
Commit 302a93bd authored by Jan Trávníček's avatar Jan Trávníček
Browse files

fix reading empty element with attributes

parent 08a1b593
No related branches found
No related tags found
No related merge requests found
......@@ -59,10 +59,12 @@ int SaxParseInterface::xmlSAXUserParse(xmlTextReaderPtr reader, std::deque<Token
while (ret == 1) {
xmlChar* name = xmlTextReaderName(reader);
xmlChar* value;
bool empty;
 
switch(xmlTextReaderNodeType(reader)) {
case 1: // START_ELEMENT
out.emplace_back((const char*) name, Token::TokenType::START_ELEMENT);
empty = xmlTextReaderIsEmptyElement(reader);
while(xmlTextReaderMoveToNextAttribute(reader)) {
xmlChar* attrName = xmlTextReaderName(reader);
xmlChar* attrValue = xmlTextReaderValue(reader);
......@@ -74,7 +76,7 @@ int SaxParseInterface::xmlSAXUserParse(xmlTextReaderPtr reader, std::deque<Token
xmlFree(attrName);
xmlFree(attrValue);
}
if(xmlTextReaderIsEmptyElement(reader)) out.emplace_back((const char*) name, Token::TokenType::END_ELEMENT);
if(empty) out.emplace_back((const char*) name, Token::TokenType::END_ELEMENT);
break;
case 3: //CHARACTER
value = xmlTextReaderValue(reader);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment