fixed empty attribute reading bug

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

@ -552,7 +552,7 @@ namespace xml {
if (nameRead) { // read attribute
std::string attrname(1, c), attrvalue;
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
while (is && is.get(c) && ws(c)); // skip ws
if (c!='"')
@ -560,7 +560,9 @@ namespace xml {
while (is && is.get(c) && c!='"') attrvalue+=c;
if (c!='"')
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())
throw duplicate_attribute(position, is, tag, attrname);
tag.attributes[attrname] = attrvalue;

Loading…
Cancel
Save