Merge pull request #347 from JamesB7/master
[mono.git] / mcs / class / System.XML / Mono.Xml / XmlFilterReader.cs
index 68511894ae6f76c18c358347d459768cde718449..24494382abaffc61f64d2edb01e42388bbc0af4b 100644 (file)
@@ -5,26 +5,26 @@
 //     Atsushi Enomoto <atsushi@ximian.com>\r
 //\r
 // Copyright (c) 2004 Novell Inc. All rights reserved\r
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
+//\r
+// Permission is hereby granted, free of charge, to any person obtaining\r
+// a copy of this software and associated documentation files (the\r
+// "Software"), to deal in the Software without restriction, including\r
+// without limitation the rights to use, copy, modify, merge, publish,\r
+// distribute, sublicense, and/or sell copies of the Software, and to\r
+// permit persons to whom the Software is furnished to do so, subject to\r
+// the following conditions:\r
+// \r
+// The above copyright notice and this permission notice shall be\r
+// included in all copies or substantial portions of the Software.\r
+// \r
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+//\r
 \r
 //\r
 // Similar to SAX DefaultHandler\r
 \r
 #if NET_2_0\r
 using System;\r
+using System.Collections.Generic;\r
 using System.Xml;\r
 using System.Xml.Schema;\r
 \r
 namespace Mono.Xml\r
 {\r
-       internal class XmlFilterReader : XmlReader, IXmlLineInfo\r
+       internal class XmlFilterReader : XmlReader, IXmlLineInfo, IXmlNamespaceResolver\r
        {\r
                XmlReader reader;\r
                XmlReaderSettings settings;\r
@@ -46,7 +47,7 @@ namespace Mono.Xml
                public XmlFilterReader (XmlReader reader, XmlReaderSettings settings)\r
                {\r
                        this.reader = reader;\r
-                       this.settings = settings;\r
+                       this.settings = settings.Clone ();\r
                        this.lineInfo = reader as IXmlLineInfo;\r
                }\r
 \r
@@ -96,12 +97,7 @@ namespace Mono.Xml
                        get { return reader.Prefix; }\r
                }\r
 \r
-#if NET_2_1\r
-               internal\r
-#else\r
-               public\r
-#endif\r
-               override bool HasValue {\r
+               public override bool HasValue {\r
                        get { return reader.HasValue; }\r
                }\r
 \r
@@ -260,42 +256,30 @@ namespace Mono.Xml
                        return reader.ReadString ();\r
                }\r
 \r
-#if NET_1_1\r
-#else\r
-               public override string ReadInnerXml ()\r
+               public override string LookupNamespace (string prefix)\r
                {\r
-                       return ReadInnerXmlInternal ();\r
+                       return reader.LookupNamespace (prefix);\r
                }\r
 \r
-               public override string ReadOuterXml ()\r
+               public override void ResolveEntity ()\r
                {\r
-                       return ReadOuterXmlInternal ();\r
+                       reader.ResolveEntity ();\r
                }\r
-#endif\r
 \r
-               public override string LookupNamespace (string prefix)\r
-               {\r
-                       return reader.LookupNamespace (prefix);\r
+               public override bool ReadAttributeValue () {\r
+                       return reader.ReadAttributeValue ();\r
                }\r
 \r
-#if NET_2_1\r
-               internal\r
-#else\r
-               public\r
-#endif\r
-               override void ResolveEntity ()\r
+               string IXmlNamespaceResolver.LookupPrefix (string ns)\r
                {\r
-                       reader.ResolveEntity ();\r
+                       return ((IXmlNamespaceResolver) reader).LookupPrefix (ns);\r
                }\r
 \r
-#if NET_2_1\r
-               internal\r
-#else\r
-               public\r
-#endif\r
-               override bool ReadAttributeValue () {\r
-                       return reader.ReadAttributeValue ();\r
+               IDictionary<string, string> IXmlNamespaceResolver.GetNamespacesInScope (XmlNamespaceScope scope)\r
+               {\r
+                       return ((IXmlNamespaceResolver) reader).GetNamespacesInScope (scope);\r
                }\r
+\r
                #endregion\r
        }\r
 }\r