Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs/class
diff options
context:
space:
mode:
authorAtsushi Eno <atsushieno@gmail.com>2004-09-03 14:51:27 +0400
committerAtsushi Eno <atsushieno@gmail.com>2004-09-03 14:51:27 +0400
commit2d0b5409f6fa89be0a1b57c4fd339c60213e8520 (patch)
treeede2974b6332223541b0facbbbb83428cc942525 /mcs/class
parent56323a4669bd26f74b4408286a449f73498afc38 (diff)
2004-09-03 Atsushi Enomoto <atsushi@ximian.com>
* XmlTextReader.cs : When Normalization is true, CRLF and CR should be converted to single LF. This should fix part of bug #62076. svn path=/branches/mono-1-0/mcs/; revision=33263
Diffstat (limited to 'mcs/class')
-rw-r--r--mcs/class/System.XML/System.Xml/ChangeLog5
-rw-r--r--mcs/class/System.XML/System.Xml/XmlTextReader.cs24
2 files changed, 25 insertions, 4 deletions
diff --git a/mcs/class/System.XML/System.Xml/ChangeLog b/mcs/class/System.XML/System.Xml/ChangeLog
index 231eec66e8d..95981aa94bf 100644
--- a/mcs/class/System.XML/System.Xml/ChangeLog
+++ b/mcs/class/System.XML/System.Xml/ChangeLog
@@ -1,3 +1,8 @@
+2004-09-03 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlTextReader.cs : When Normalization is true, CRLF and CR should
+ be converted to single LF. This should fix part of bug #62076.
+
2004-08-27 Atsushi Enomoto <atsushi@ximian.com>
* XmlAttribute.cs : some property getters threw NullReferenceException
diff --git a/mcs/class/System.XML/System.Xml/XmlTextReader.cs b/mcs/class/System.XML/System.Xml/XmlTextReader.cs
index 8c21e3d02f8..221541167bf 100644
--- a/mcs/class/System.XML/System.Xml/XmlTextReader.cs
+++ b/mcs/class/System.XML/System.Xml/XmlTextReader.cs
@@ -1548,8 +1548,14 @@ namespace System.Xml
ch = ReadReference (false);
if (returnEntityReference) // Returns -1 if char validation should not be done
break;
- }
- else {
+ } else if (normalization && ch == '\r') {
+ ReadChar ();
+ ch = ReadChar ();
+ if (ch != '\n')
+ // append '\n' instead of '\r'.
+ AppendValueChar ('\n');
+ // and in case of "\r\n", discard '\r'.
+ } else {
if (XmlChar.IsInvalid (ch))
throw new XmlException (this, "Not allowed character was found.");
ch = ReadChar ();
@@ -2142,8 +2148,18 @@ namespace System.Xml
skip = true;
}
}
- if (normalization && XmlChar.IsInvalid (ch))
- throw new XmlException (this, "Invalid character was found.");
+ if (normalization) {
+ if (ch == '\r') {
+ ch = PeekChar ();
+ if (ch != '\n')
+ // append '\n' instead of '\r'.
+ AppendValueChar ('\n');
+ // otherwise, discard '\r'.
+ continue;
+ }
+ else if (XmlChar.IsInvalid (ch))
+ throw new XmlException (this, "Invalid character was found.");
+ }
AppendValueChar (ch);
}