(DISTFILES): Comment out a few missing files.
[mono-project.git] / mcs / class / System.XML / Test / System.Xml / standalone_tests / domdump.cs
blob9897f89b24c3383c93bfbeb5d796ab7c998d23a6
1 using System;
2 using System.IO;
3 using System.Xml;
5 public class DomDumper
7 public static void Main ()
9 new DomDumper ().TestOASIS ();
12 public void TestOASIS ()
14 XmlDocument doc = new XmlDocument ();
15 foreach (FileInfo fi in
16 new DirectoryInfo (@"xml-test-suite/xmlconf/oasis").GetFiles ("*.xml")) {
17 try {
18 if (fi.Name.IndexOf ("fail") >= 0)
19 continue;
21 Console.WriteLine (fi.Name);
23 XmlTextReader xtr = new XmlTextReader (fi.FullName);
24 xtr.Namespaces = false;
25 xtr.Normalization = true;
26 doc.RemoveAll ();
27 doc.Load (xtr);
29 DumpDom (doc);
31 } catch (XmlException ex) {
32 if (fi.Name.IndexOf ("pass") >= 0)
33 Console.WriteLine ("Incorrectly invalid: " + fi.FullName + "\n" + ex.Message);
38 public void DumpDom (XmlNode n)
40 Console.Write (n.NodeType);
41 Console.Write (' ');
42 Console.Write (n.Prefix);
43 Console.Write (' ');
44 Console.Write (n.Name);
45 Console.Write (' ');
46 Console.Write (n.LocalName);
47 Console.Write (' ');
48 Console.Write (n.NamespaceURI);
49 Console.Write (' ');
50 Console.Write (n.Value);
51 Console.WriteLine (' ');
53 Console.WriteLine ("Attributes::::");
54 Console.Write (n.Attributes != null);
55 if (n.Attributes != null) {
56 Console.Write (' ');
57 Console.Write (n.Attributes.Count);
58 Console.Write (' ');
59 for (int i = 0; i < n.Attributes.Count; i++)
60 DumpDom (n.Attributes [i]);
62 Console.WriteLine (":::Attributes End");
64 Console.WriteLine ("ChildNodes::::");
65 Console.Write (n.ChildNodes != null);
66 if (n.ChildNodes != null) {
67 Console.Write (' ');
68 Console.Write (n.ChildNodes.Count);
69 Console.Write (' ');
70 for (int i = 0; i < n.ChildNodes.Count; i++)
71 DumpDom (n.ChildNodes [i]);
73 Console.WriteLine (":::ChildNodes End");