2005-01-13 Atsushi Enomoto <atsushi@ximian.com>
[mono.git] / mcs / class / System.XML / System.Xml.Schema / XmlSchemaInclude.cs
index c592557da0a27f8a02c69977ecc3f5074e279a40..7bfe81d4f14f12c58c7b2d0aa96260c22ab1e74a 100755 (executable)
@@ -1,5 +1,26 @@
 // Author: Dwivedi, Ajay kumar\r
 //            Adwiv@Yahoo.com\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.
+//
 using System;\r
 using System.Xml.Serialization;\r
 using System.Xml;\r
@@ -12,23 +33,24 @@ namespace System.Xml.Schema
        public class XmlSchemaInclude : XmlSchemaExternal\r
        {\r
                private XmlSchemaAnnotation annotation;\r
-               public static string xmlname = "include";\r
+               const string xmlname = "include";\r
 \r
                public XmlSchemaInclude()\r
                {\r
                }\r
-               [XmlElement("annotation",Namespace="http://www.w3.org/2001/XMLSchema")]\r
+               [XmlElement("annotation",Namespace=XmlSchema.Namespace)]\r
                public XmlSchemaAnnotation Annotation \r
                {\r
                        get{ return  annotation; } \r
                        set{ annotation = value; }\r
                }\r
-//<include \r
-//  id = ID \r
-//  schemaLocation = anyURI \r
-//  {any attributes with non-schema namespace . . .}>\r
-//  Content: (annotation?)\r
-//</include>\r
+\r
+               //<include \r
+               //  id = ID \r
+               //  schemaLocation = anyURI \r
+               //  {any attributes with non-schema namespace . . .}>\r
+               //  Content: (annotation?)\r
+               //</include>\r
                internal static XmlSchemaInclude Read(XmlSchemaReader reader, ValidationEventHandler h)\r
                {\r
                        XmlSchemaInclude include = new XmlSchemaInclude();\r
@@ -55,17 +77,13 @@ namespace System.Xml.Schema
                                {\r
                                        include.SchemaLocation = reader.Value;\r
                                }\r
-                               else if(reader.NamespaceURI == "" || reader.NamespaceURI == XmlSchema.Namespace)\r
+                               else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)\r
                                {\r
                                        error(h,reader.Name + " is not a valid attribute for include",null);\r
                                }\r
                                else\r
                                {\r
-                                       if(reader.Prefix == "xmlns")\r
-                                               include.Namespaces.Add(reader.LocalName, reader.Value);\r
-                                       else if(reader.Name == "xmlns")\r
-                                               include.Namespaces.Add("",reader.Value);\r
-                                       //TODO: Add to Unhandled attributes\r
+                                       XmlSchemaUtil.ReadUnhandledAttribute(reader,include);\r
                                }\r
                        }\r
 \r
@@ -97,4 +115,4 @@ namespace System.Xml.Schema
                        return include;\r
                }\r
        }\r
-}
\ No newline at end of file
+}