fixed empty attribute reading bug

master
Marc Wäckerlin 16 years ago
parent 67d71161b3
commit 0965b21e27
  1. 6
      src/xml.cxx

@ -552,7 +552,7 @@ namespace xml {
if (nameRead) { // read attribute if (nameRead) { // read attribute
std::string attrname(1, c), attrvalue; std::string attrname(1, c), attrvalue;
while (is && is.get(c) && c!='=' && c!='>' && !ws(c)) attrname+=c; while (is && is.get(c) && c!='=' && c!='>' && !ws(c)) attrname+=c;
while (c!='=' && is && is.get(c) && ws(c)); // skip ws, search '=' while (ws(c) && is && is.get(c)); // skip ws, search '='
if (c=='=') { // get the value if (c=='=') { // get the value
while (is && is.get(c) && ws(c)); // skip ws while (is && is.get(c) && ws(c)); // skip ws
if (c!='"') if (c!='"')
@ -560,7 +560,9 @@ namespace xml {
while (is && is.get(c) && c!='"') attrvalue+=c; while (is && is.get(c) && c!='"') attrvalue+=c;
if (c!='"') if (c!='"')
throw attribute_value_not_quoted(position, is, tag, c, attrname); throw attribute_value_not_quoted(position, is, tag, c, attrname);
} else is.unget(); // read too far } else {
is.unget();
}// read too far
if (tag.attributes.find(attrname)!=tag.attributes.end()) if (tag.attributes.find(attrname)!=tag.attributes.end())
throw duplicate_attribute(position, is, tag, attrname); throw duplicate_attribute(position, is, tag, attrname);
tag.attributes[attrname] = attrvalue; tag.attributes[attrname] = attrvalue;

Loading…
Cancel
Save