Reformat changes, and add some small debugging information to catch errors
[mono.git] / mcs / class / System.XML / System.Xml.Schema / XmlSchemaAppInfo.cs
index ae060eb723849b4fc64c01b902c73de28f9cd6c2..da66837c504c8de8c0644496050d86101fb71906 100755 (executable)
@@ -16,7 +16,13 @@ namespace System.Xml.Schema
 \r
                public XmlSchemaAppInfo()\r
                {\r
-                       source = string.Empty;\r
+               }\r
+\r
+               [System.Xml.Serialization.XmlAttribute("source")]\r
+               public string Source \r
+               {\r
+                       get{ return  source; } \r
+                       set{ source = value; }\r
                }\r
 \r
                [XmlAnyElement]\r
@@ -27,11 +33,59 @@ namespace System.Xml.Schema
                        set{ markup = value; }\r
                }\r
 \r
-               [System.Xml.Serialization.XmlAttribute("source")]\r
-               public string Source \r
+               //<appinfo\r
+               //  source = anyURI>\r
+               //  Content: ({any})*\r
+               //</appinfo>\r
+               internal static XmlSchemaAppInfo Read(XmlSchemaReader reader, ValidationEventHandler h, out bool skip)\r
                {\r
-                       get{ return  source; } \r
-                       set{ source = value; }\r
+                       skip = false;\r
+                       XmlSchemaAppInfo appinfo = new XmlSchemaAppInfo();\r
+                       reader.MoveToElement();\r
+\r
+                       if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != "appinfo")\r
+                       {\r
+                               error(h,"Should not happen :1: XmlSchemaAppInfo.Read, name="+reader.Name,null);\r
+                               reader.SkipToEnd();\r
+                               return null;\r
+                       }\r
+\r
+                       appinfo.LineNumber = reader.LineNumber;\r
+                       appinfo.LinePosition = reader.LinePosition;\r
+                       appinfo.SourceUri = reader.BaseURI;\r
+\r
+                       while(reader.MoveToNextAttribute())\r
+                       {\r
+                               if(reader.Name == "source")\r
+                               {\r
+                                       appinfo.source = reader.Value;\r
+                               }\r
+                               else\r
+                               {\r
+                                       error(h,reader.Name + " is not a valid attribute for appinfo",null);\r
+                               }\r
+                       }\r
+\r
+                       reader.MoveToElement();\r
+                       if(reader.IsEmptyElement)\r
+                               return appinfo;\r
+\r
+                       //Content {any}*\r
+                       //FIXME: This is a pure Quick Hack; There must be a another method;\r
+                       XmlDocument xmldoc = new XmlDocument();\r
+                       xmldoc.AppendChild(xmldoc.ReadNode(reader));\r
+                       XmlNode root = xmldoc.FirstChild;\r
+                       if(root != null && root.ChildNodes != null)\r
+                       {\r
+                               appinfo.Markup = new XmlNode[root.ChildNodes.Count];\r
+                               for(int i=0;i<root.ChildNodes.Count;i++)\r
+                               {\r
+                                       appinfo.Markup[i] = root.ChildNodes[i];\r
+                               }\r
+                       }\r
+                       if(reader.NodeType == XmlNodeType.Element || reader.NodeType == XmlNodeType.EndElement)\r
+                               skip = true;\r
+                       return appinfo;\r
                }\r
        }\r
 }\r