(DISTFILES): Comment out a few missing files.
[mono-project.git] / mcs / class / System.XML / Test / System.Xml / standalone_tests / xrdump.cs
blobbfc3f9629e94252a535b55c329c5af73ae46a258
1 using System;
2 using System.IO;
3 using System.Xml;
5 public class XmlReaderDumper
7 public static void Main ()
9 new XmlReaderDumper ().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 while (!xtr.EOF) {
25 DumpReader (xtr, false);
26 xtr.Read ();
29 } catch (XmlException ex) {
30 if (fi.Name.IndexOf ("pass") >= 0)
31 Console.WriteLine ("Incorrectly invalid: " + fi.FullName + "\n" + ex.Message);
36 public void DumpReader (XmlReader xr, bool attValue)
38 Console.WriteLine ("NodeType: " + xr.NodeType);
39 Console.WriteLine ("Prefix: " + xr.Prefix);
40 Console.WriteLine ("Name: " + xr.Name);
41 Console.WriteLine ("LocalName: " + xr.LocalName);
42 Console.WriteLine ("NamespaceURI: " + xr.NamespaceURI);
43 Console.WriteLine ("Value: " + xr.Value);
44 Console.WriteLine ("Depth: " + xr.Depth);
45 Console.WriteLine ("IsEmptyElement: " + xr.IsEmptyElement);
47 if (xr.NodeType == XmlNodeType.Attribute) {
48 Console.WriteLine ("Attribute Values::::");
49 while (xr.ReadAttributeValue ())
50 DumpReader (xr, true);
51 Console.WriteLine (":::Attribute Values End");
52 } else if (!attValue) {
53 Console.WriteLine ("Attributes::::");
54 Console.Write (xr.AttributeCount);
55 if (xr.MoveToFirstAttribute ()) {
56 do {
57 DumpReader (xr, false);
58 } while (xr.MoveToNextAttribute ());
59 xr.MoveToElement ();
61 Console.WriteLine (":::Attributes End");