inohilog

/var/log/inohiro.log

XPath

XPath式。
XPath式でデータ抽出。

Code

<Log>
<!-- 省略 -->
	<Message Date="2008/10/16" Time="1:24:11" DateTime="2008-10-15T16:24:11.703Z" SessionID="235">
		<From>
			<User FriendlyName="こにやn"/>
		</From>
		<To>
			<User FriendlyName="いのうえひろゆき@Win"/>
		</To>
		<Text Style="font-family:MS UI Gothic; color:#800000; "></Text>
	</Message>
</Log>
using System;
using System.Xml;

namespace XPath_sampleApplication1
{
	class Program
	{
		static void Main( string[] args )
		{
			string xPathQuery = "/Log/Message/Text";

			XmlDocument doc = new XmlDocument();
			doc.Load( @"C:\Users\Hiroyuki Inoue\Documents\受信したファイル\menderu2003jp2691334062\History\koniyan19883221983230.xml" );
			XmlNodeList nodes = doc.SelectNodes( xPathQuery );

			foreach( XmlNode node in nodes )
				Console.WriteLine( node.InnerText );

			Console.ReadKey();
		}
	}
}

Result

そろそろ寝るー
おk
おつかれ
また飯行きましょう
はーい