X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FSystem.XML%2FSystem.Xml%2FXmlSignificantWhitespace.cs;h=1df1a7f512ba18c87115db9ddf7c11e01fb9f5a8;hb=2a6da5d6f1e6d02f0e3595b3a02af6cacea2772c;hp=8999730699947a6a27228c80855886b70c59aa96;hpb=420c7f042a15146588f183a96efed522dda17923;p=mono.git diff --git a/mcs/class/System.XML/System.Xml/XmlSignificantWhitespace.cs b/mcs/class/System.XML/System.Xml/XmlSignificantWhitespace.cs index 89997306999..1df1a7f512b 100644 --- a/mcs/class/System.XML/System.Xml/XmlSignificantWhitespace.cs +++ b/mcs/class/System.XML/System.Xml/XmlSignificantWhitespace.cs @@ -8,6 +8,7 @@ // using System; +using System.Xml.XPath; namespace System.Xml { @@ -32,9 +33,19 @@ namespace System.Xml get { return XmlNodeType.SignificantWhitespace; } } + internal override XPathNodeType XPathNodeType { + get { + return XPathNodeType.SignificantWhitespace; + } + } + public override string Value { get { return Data; } - set {} + set { + if (IsValidWhitespaceChar (value) == false) + throw new ArgumentException ("Invalid whitespace characters."); + base.Data = value; + } } // Methods @@ -49,5 +60,13 @@ namespace System.Xml { w.WriteWhitespace (Data); } + + private bool IsValidWhitespaceChar (string text) + { + foreach (char c in text) + if ((c != ' ') && (c != '\r') && (c != '\n') && (c != '\t')) + return false; + return true; + } } }