2013. 7. 24. 14:16
Recently, I got a question in an email asking how to load an XML file and display it on the system console.
We can use XmlDocument to read an XML document. The Load method is used to load an XML into an XmlDocument. Once a document is loaded, we can use the Save method to display its content to the console. The key is, passing Console.Out as a parameter.
XmlDocument xmlDoc = new XmlDocument();
string filename = @"C:\Books\Books.xml";
xmlDoc.Load(filename);
xmlDoc.Save(Console.Out);
You must import the System.Xml namespace in your code.
'.NET > C#' 카테고리의 다른 글
[스크랩] [C#] HTTP/HTTPS 송수신 (HttpWebRequest/HttpWebResponse) (0) | 2013.10.11 |
---|---|
[영어, 영상] What is new in C# 6.0 (0) | 2013.08.20 |
Disposing DataContext/ObjectContext (0) | 2013.06.26 |
ADO.NET Entity Model 짧은 강좌 (0) | 2013.06.18 |
[스크랩] [영어 원문] C#: Currying (0) | 2013.06.12 |