From 3e8dccf6ab0918e89c4275ea9bf454d34e01534b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 24 Aug 2006 15:02:39 +0000 Subject: [PATCH] * Escape newlines in XML attributes to prevent them from being normalised away. --- src/libutil/xml-writer.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libutil/xml-writer.cc b/src/libutil/xml-writer.cc index cd37dff56..27235933e 100644 --- a/src/libutil/xml-writer.cc +++ b/src/libutil/xml-writer.cc @@ -89,6 +89,9 @@ void XMLWriter::writeAttrs(const XMLAttrs & attrs) if (c == '"') output << """; else if (c == '<') output << "<"; else if (c == '&') output << "&"; + /* Escape newlines to prevent attribute normalisation (see + XML spec, section 3.3.3. */ + else if (c == '\n') output << " "; else output << c; } output << "\"";