* Escape newlines in XML attributes to prevent them from being

normalised away.
This commit is contained in:
Eelco Dolstra 2006-08-24 15:02:39 +00:00
parent 215ec2ddc6
commit 3e8dccf6ab
1 changed files with 3 additions and 0 deletions

View File

@ -89,6 +89,9 @@ void XMLWriter::writeAttrs(const XMLAttrs & attrs)
if (c == '"') output << "&quot;";
else if (c == '<') output << "&lt;";
else if (c == '&') output << "&amp;";
/* Escape newlines to prevent attribute normalisation (see
XML spec, section 3.3.3. */
else if (c == '\n') output << "&#xA;";
else output << c;
}
output << "\"";