KẢ𓚁B2C#ŁiCS02.csj

using System;
using System.Xml;
using System.Text;

namespace CS02
{
	/// <summary>
	/// CS02FXmlTextReader̊ȒPȗ
	/// </summary>
	class Class1
	{
		/// <summary>
		/// C Gg |CgłB
		/// </summary>
		[STAThread]
		static void Main(string[] args)
		{
			int n;

			//CS01쐬XMLt@C͂Ɏw
			XmlTextReader xtr=new XmlTextReader("../../../CS01/CS01output.xml");

			//um[hvɓǂݍ
			while(xtr.Read())
			{
				Console.WriteLine(" NodeType={0} Node Name={1}",xtr.NodeType,xtr.Name);
				if(xtr.NodeType==XmlNodeType.Element )
				{
					for(n=0;n<xtr.Depth;n++)
						Console.Write("  ");
					Console.WriteLine("{0}",xtr.Name);
				}

				if(xtr.NodeType==XmlNodeType.Text )
				{
					if(xtr.HasValue)
					{
						for(n=0;n<xtr.Depth;n++)
							Console.Write("  ");
						Console.WriteLine("  {0}",xtr.Value);
					}
					else
						Console.WriteLine();
				}
			}

			xtr.Close();
		}
	}
}

/**
 * 
 CS01XML
  Staff
    Name
        RcY
    SID
        12
  Staff
    Name
        ؎Y
    SID
        13
  Staff
    Name
        cOY
    SID
        14
**/