3 // Adam Treat (manyoso@yahoo.com)
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
22 Console.Write ("docval [file]\n\n");
25 public static void Main(string[] args)
27 DocVal val = new DocVal(args);
30 public DocVal(string [] args)
34 int argc = args.Length;
36 for(int i = 0; i < argc; i++) {
38 if(arg.EndsWith(".xml")) {
49 XmlTextReader read = new XmlTextReader(file);
50 XmlValidatingReader validate = new XmlValidatingReader(read);
51 validate.ValidationType = ValidationType.Auto;
52 while (validate.Read()) {
53 switch (validate.NodeType) {
54 case XmlNodeType.XmlDeclaration:
55 Console.WriteLine("** XML declaration");
57 case XmlNodeType.DocumentType:
58 Console.WriteLine("** DocumentType node");
60 case XmlNodeType.Document:
61 Console.WriteLine("** Document node");
63 case XmlNodeType.Element:
64 Console.WriteLine("** Element: {0}", validate.Name);
66 case XmlNodeType.EndElement:
67 Console.WriteLine("** End Element: {0}", validate.Name);
69 case XmlNodeType.Text:
70 Console.WriteLine("** Text: {0}", validate.Value);
72 case XmlNodeType.Comment:
73 Console.WriteLine("** Comment: {1}", validate.Name, validate.Value);
75 case XmlNodeType.Whitespace:
79 Console.WriteLine("** ERROR: Unknown node type");
83 } catch (Exception e) {
88 Console.Write("\n Validation: PASSED!\n\n");
90 Console.Write("\n Validation: FAILED!\n\n");