I'm developing a Windows Phone 7.5 app and I'm lost.
I have to read the following xml:
<?xml version="1.0" encoding="utf-8" ?>
<cards>
<card id ="0">
<name lang="en">Mad</name>
<description lang="en">This...</description>
</card>
...
</cards>
And I'm have to finish this piece of code:
private void UpdateCardDescriptions(int[] numbers, string lang)
{
for (int i = 0; i < numbers.Length; i++)
{
XmlReader reader = XmlReader.Create("Data/CardDescriptions.xml");
reader.MoveToContent();
while (reader.Read())
{
if ((reader.NodeType == XmlNodeType.Element) &&
(reader.Name == "card") &&
(reader.GetAttribute("id").Equals(numbers[i].ToString())))
{
string description = string.Empty;
while (reader.Read())
{
}
switch (i)
{
case 0:
Card01Desc.Text = description;
break;
case 1:
Card02Desc.Text = description;
break;
case 2:
Card03Desc.Text = description;
break;
}
}
if (reader.NodeType == XmlNodeType.EndElement && reader.Name == "cards")
{
break;
}
}
reader.Close();
}
}
I have to finish this code:
while (reader.Read())
{
}
If I'm looking for a description in a language, lang, for a card with an id. How can I get the corresponding description for the same language, lang.
I'm sorry, I'm blocked.