From cc6f0a1de619f757097f4bfdb71744bd3a1a0047 Mon Sep 17 00:00:00 2001 From: hogliux Date: Wed, 15 Jun 2016 16:15:48 +0100 Subject: [PATCH] Replace CR and CRLF endings with unix (LF) style endings in xml document as required by the W3 xml specification --- modules/juce_core/xml/juce_XmlDocument.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/juce_core/xml/juce_XmlDocument.cpp b/modules/juce_core/xml/juce_XmlDocument.cpp index c0f016e3bb..bf56f4f637 100644 --- a/modules/juce_core/xml/juce_XmlDocument.cpp +++ b/modules/juce_core/xml/juce_XmlDocument.cpp @@ -617,9 +617,17 @@ void XmlDocument::readChildElements (XmlElement& parent) } else { - for (;;) + for (;; ++input) { - const juce_wchar nextChar = *input; + juce_wchar nextChar = *input; + + if (nextChar == '\r') + { + nextChar = '\n'; + + if (input[1] == '\n') + continue; + } if (nextChar == '<' || nextChar == '&') break; @@ -633,7 +641,6 @@ void XmlDocument::readChildElements (XmlElement& parent) textElementContent.appendUTF8Char (nextChar); contentShouldBeUsed = contentShouldBeUsed || ! CharacterFunctions::isWhitespace (nextChar); - ++input; } } }