How can we read a xml data file into Windows.Data.Xml.Dom.XMlDocument
?
The following code is possible only for System.Xml.XmlDocument
.
XmlDocument myxml = XmlDocument.Load("abc.xml");
How can we read a xml data file into Windows.Data.Xml.Dom.XMlDocument
?
The following code is possible only for System.Xml.XmlDocument
.
XmlDocument myxml = XmlDocument.Load("abc.xml");
I read the xml file content to a string, and then use LoadXml()
:
string fileContent;
StorageFile tileTemplateFile =
await StorageFile.GetFileFromApplicationUriAsync(new Uri(@"<path to file>"));
using (StreamReader reader =
new StreamReader(await tileTemplateFile.OpenStreamForReadAsync()))
{
fileContent = await reader.ReadToEndAsync();
}
XmlDocument tileXml = new XmlDocument();
tileXml.LoadXml(fileContent);
I got most of the code from this answer.