Nowadays, XmlDeclaratoin.WriteTo() writes PI instead of raw.
[mono.git] / mcs / class / System.XML / System.Xml / XmlValidatingReader.cs
index 4a8c376400844cb58eaf9458dbb17b315c128a3e..de12750f0abf45f025b3286367be2114c2815e41 100644 (file)
@@ -61,7 +61,7 @@ namespace System.Xml
                bool resolverSpecified;
                ValidationType validationType;
                // for 2.0: Now it is obsolete. It is allocated only when it is required
-               XmlSchemaSet schemas;
+               XmlSchemaCollection schemas;
                DTDValidatingReader dtdReader;
                IHasXmlSchemaInfo schemaInfo;
                StringBuilder storedCharacters;
@@ -289,16 +289,11 @@ namespace System.Xml
                public XmlSchemaCollection Schemas {
                        get {
                                if (schemas == null)
-                                       schemas = new XmlSchemaSet ();
-                               return schemas.SchemaCollection;
+                                       schemas = new XmlSchemaCollection (NameTable);
+                               return schemas;
                        }
                }
 
-               internal void SetSchemas (XmlSchemaSet schemas)
-               {
-                       this.schemas = schemas;
-               }
-
                public object SchemaType {
                        get { return schemaInfo.SchemaType; }
                }
@@ -310,7 +305,8 @@ namespace System.Xml
                }
 #endif
 
-               [MonoTODO ("We decided not to support XDR schema that spec is obsolete.")]
+               [MonoTODO]
+               // We decided not to support XDR schema; it is obsolete.
                public ValidationType ValidationType {
                        get { return validationType; }
                        set {
@@ -387,7 +383,12 @@ namespace System.Xml
                }
 
                XmlParserContext IHasXmlParserContext.ParserContext {
-                       get { return dtdReader != null ? dtdReader.ParserContext : null; }
+                       get {
+                               if (dtdReader != null)
+                                       return dtdReader.ParserContext;
+                               IHasXmlParserContext i = sourceReader as IHasXmlParserContext;
+                               return i != null ? i.ParserContext : null;
+                       }
                }
 
 #if NET_2_0
@@ -473,10 +474,11 @@ namespace System.Xml
                        return validatingReader.MoveToNextAttribute ();
                }
 
-               [MonoTODO ("We decided not to support XDR schema that spec is obsolete.")]
+               [MonoTODO]
+               // We decided not to support XDR schema; it is obsolete.
                public override bool Read ()
                {
-                       if (ReadState == ReadState.Initial) {
+                       if (validatingReader == null) {
                                switch (ValidationType) {
                                case ValidationType.Auto:
                                case ValidationType.None:
@@ -512,35 +514,10 @@ namespace System.Xml
                        return validatingReader.ReadAttributeValue ();
                }
 
-#if NET_1_0
-               // LAMESPEC: MS.NET 1.0 has critical bug here.
-               // After calling these methods, validation does not work anymore!
-               public override string ReadInnerXml ()
-               {
-                       if (validatingReader == null)
-                               return "";
-                       return validatingReader.ReadInnerXml ();
-               }
-
-               public override string ReadOuterXml ()
-               {
-                       if (validatingReader == null)
-                               return "";
-                       return validatingReader.ReadOuterXml ();
-               }
-#endif
-
-#if NET_1_0
-               public override string ReadString ()
-               {
-                       return base.ReadStringInternal ();
-               }
-#else
                public override string ReadString ()
                {
                        return base.ReadString ();
                }
-#endif
 
                public object ReadTypedValue ()
                {
@@ -601,7 +578,7 @@ namespace System.Xml
                }
 
 #if NET_2_0
-               [MonoTODO ("Check how expanded entity is handled here.")]
+               [MonoTODO] // FIXME: Check how expanded entity is handled here.
                public override int ReadContentAsBase64 (byte [] buffer, int offset, int length)
                {
                        if (validatingReader != null)
@@ -610,7 +587,7 @@ namespace System.Xml
                                return sourceReader.ReadContentAsBase64 (buffer, offset, length);
                }
 
-               [MonoTODO ("Check how expanded entity is handled here.")]
+               [MonoTODO] // FIXME: Check how expanded entity is handled here.
                public override int ReadContentAsBinHex (byte [] buffer, int offset, int length)
                {
                        if (validatingReader != null)
@@ -619,7 +596,7 @@ namespace System.Xml
                                return sourceReader.ReadContentAsBinHex (buffer, offset, length);
                }
 
-               [MonoTODO ("Check how expanded entity is handled here.")]
+               [MonoTODO] // FIXME: Check how expanded entity is handled here.
                public override int ReadElementContentAsBase64 (byte [] buffer, int offset, int length)
                {
                        if (validatingReader != null)
@@ -628,7 +605,7 @@ namespace System.Xml
                                return sourceReader.ReadElementContentAsBase64 (buffer, offset, length);
                }
 
-               [MonoTODO ("Check how expanded entity is handled here.")]
+               [MonoTODO] // FIXME: Check how expanded entity is handled here.
                public override int ReadElementContentAsBinHex (byte [] buffer, int offset, int length)
                {
                        if (validatingReader != null)