Loading an XML Document from a File or a String
I just got stuck on something, and it was one of those "in your face" type of solutions that my friend Jeff Julian had to help me with.
I have a file called c:\temp.xml.
In C# I was trying to load this into a XmlDocument. Easy enough.
XmlDocument xml = new XmlDocument();
xml.Load("c:\temp.xml");
Of course the values aren't hard coded, but for the point this works fine.
Here was my problem. I had the contents of c:\temp.xml already loaded in as a string called xmlContents. So I was trying to
xml.Load(xmlContents);
And I was getting an "Invalid URI" error.
The solution.
xml.LoadXml(xmlContents);
'wpf' 카테고리의 다른 글
[wpf] Observable Collection을 이용한 바인딩 샘플 (0) | 2009.09.21 |
---|---|
[wpf] xml 만들어서 file로 쓰기 (1) | 2009.09.16 |
[wpf] MenuItem Binding걸어서 Click Event 받아오기(어느메뉴를 클릭했는지..) (0) | 2009.09.10 |
[wpf] Regex를 이용해서 string 문자를 치환하자... (0) | 2009.09.04 |
[wpf] xml viewer 만들기 (treeview 이용) (0) | 2009.08.28 |