2006-11-09 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Thu, 9 Nov 2006 08:56:16 +0000 (08:56 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Thu, 9 Nov 2006 08:56:16 +0000 (08:56 -0000)
* NewMonoXSD.cs : Ankit wants good validation error reporting ;-)

svn path=/trunk/mcs/; revision=67579

mcs/tools/mono-xsd/ChangeLog
mcs/tools/mono-xsd/NewMonoXSD.cs

index d45f14a2d2d9f1b247075b75a80a8590844c11d1..decb00d4e7ebb2974a4e34b054a8ce1bf8bf72d0 100644 (file)
@@ -1,3 +1,7 @@
+2006-11-09  Atsushi Enomoto <atsushi@ximian.com>
+
+       * NewMonoXSD.cs : Ankit wants good validation error reporting ;-)
+
 2006-11-09  Atsushi Enomoto <atsushi@ximian.com>
 
        * NewMonoXSD.cs : process all elements including imported ones. To do
index 5da7b589bda6eb8119fe308059b8e1d952a8c58c..8e332939e2a2907f96ca45f799f132724d089721 100644 (file)
@@ -402,7 +402,7 @@ namespace Mono.Util {
                        else\r
                        {\r
                                foreach (XmlSchema schema in schemas) {\r
-                                       if (!schema.IsCompiled) schema.Compile (null);\r
+                                       if (!schema.IsCompiled) schema.Compile (new ValidationEventHandler (HandleValidationError));\r
                                        foreach (XmlSchemaElement el in schema.Elements.Values)\r
                                                if (!qnames.Contains (el.QualifiedName))\r
                                                        qnames.Add (el.QualifiedName);\r
@@ -475,6 +475,14 @@ namespace Mono.Util {
                        Console.WriteLine ("Written file " + genFile);\r
                }\r
 \r
+               void HandleValidationError (object o, ValidationEventArgs e)\r
+               {\r
+                       Console.WriteLine ("{0}: {1} {2}",\r
+                               e.Severity == XmlSeverityType.Error ? "Error" : "Warning",\r
+                               e.Message,\r
+                               e.Exception != null ? e.Exception.Message : null);\r
+               }\r
+\r
                public void Error (string msg)\r
                {\r
                        throw new ApplicationException (msg);\r