XPathDocument doc = new XPathDocument(new XmlTextReader("evtx.xml"));
XPathNavigator nav = doc.CreateNavigator();
XmlNamespaceManager namespaceMgr = new XmlNamespaceManager(nav.NameTable);
namespaceMgr.AddNamespace("ns", "http://schemas.microsoft.com/win/2004/08/events/event");
XPathNodeIterator ni = nav.Select("//ns:Data", namespaceMgr);
while (ni.MoveNext())
{
ni.Current.MoveToFirstAttribute();
string _Name = ni.Current.Value;
ni.Current.MoveToParent();
Console.WriteLine(_Name + ": " + ni.Current.ToString());
}
XPathNavigator nav = doc.CreateNavigator();
XmlNamespaceManager namespaceMgr = new XmlNamespaceManager(nav.NameTable);
namespaceMgr.AddNamespace("ns", "http://schemas.microsoft.com/win/2004/08/events/event");
XPathNodeIterator ni = nav.Select("//ns:Data", namespaceMgr);
while (ni.MoveNext())
{
ni.Current.MoveToFirstAttribute();
string _Name = ni.Current.Value;
ni.Current.MoveToParent();
Console.WriteLine(_Name + ": " + ni.Current.ToString());
}
XmlNamespaceManager Class
http://msdn.microsoft.com/en-us/library/system.xml.xmlnamespacemanager.aspx
댓글 없음:
댓글 쓰기