Console.WriteLine (helpString);\r
return;\r
}\r
+ else if (option == "nologo")\r
+ {\r
+ // ignore, since we do not output a logo anyway\r
+ }\r
else\r
Error (unknownOption, option);\r
}\r
} else {\r
typename = param.Substring (0, comma);\r
string asmName = param.Substring (comma + 1);\r
-#if NET_1_1\r
Assembly asm = Assembly.LoadFile (asmName);\r
-#else\r
- Assembly asm = Assembly.LoadFrom (asmName);\r
-#endif\r
if (asm == null)\r
Error (generatorAssemblyNotFound, asmName);\r
generatorType = asm.GetType (typename);\r
foreach (string fileName in schemaNames)\r
{\r
StreamReader sr = new StreamReader (fileName);\r
- schemas.Add (XmlSchema.Read (sr, null));\r
+ schemas.Add (XmlSchema.Read (sr, new ValidationEventHandler (HandleValidationError)));\r
sr.Close ();\r
\r
if (targetFile == "") targetFile = Path.GetFileNameWithoutExtension (fileName);\r
else\r
{\r
foreach (XmlSchema schema in schemas) {\r
- if (!schema.IsCompiled) schema.Compile (null);\r
- foreach (XmlSchemaObject ob in schema.Items)\r
- if (ob is XmlSchemaElement)\r
- qnames.Add (((XmlSchemaElement)ob).QualifiedName);\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
}\r
}\r
\r
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