Hey mates,
normally I am using a MS SQL Server to store/load information but now I am playing with UWP on my Lumia and it is great. But now I want to load content from a local file and display it in a Textblock.
I have not worked for years with XML, so here's the file:
<Stations>
<Station ID="1">
<Name>ABC</Name>
<Text>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</Text>
<Picture>Assets\Pirate.ico</Picture>
</Station>
<Station ID="2">
<Name>DEF</Name>
<Text>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</Text>
<Picture>Assets\Pirate.ico</Picture>
</Station>
</Stations>
My source, does not work:
public void fillContent(int ID)
{
byte[] byteArray = Encoding.UTF8.GetBytes(@"data\stations.xml");
MemoryStream stream = new MemoryStream(byteArray);
doc.Load(stream);
foreach (XmlNode node in doc.DocumentElement.ChildNodes)
{
string text = node.InnerText;
TBText.Text = text;
}
}
But I want to load specific data, e.g. something like "WHERE ID= 'ID'", like in SQL so far.
Regards,
Vince
What I have tried:
Reading, searching via google, reading on codeproject.