Thank you F-ES Sitecore, you gave me the right direction. This is may almost-done-solution:
private void listView1_MouseDoubleClick(object sender, MouseEventArgs e)
{
string propertyid = listView1.SelectedItems[0].Text;
XmlDocument doc = new XmlDocument();
doc.Load(@"http://myUrl.com/Default.xml");
XmlNodeList nodes = doc.SelectNodes("document/Clients/Client/properties/Property");
foreach(XmlNode node in nodes)
{
if(node.SelectSingleNode("id").InnerText == propertyid)
{
XmlNodeList addresses = node.SelectNodes("Address");
foreach (XmlNode address in addresses)
{
streetBox.Text = address.SelectSingleNode("street").InnerText;
}
XmlNodeList prices = node.SelectNodes("Price");
foreach(XmlNode price in prices)
{
priceBox.Text = price.SelectSingleNode("price").InnerText;
}
}
}
}
My only problem is, that this solution is quite slow... I guess it is because of those foreach-es and the long XML source.
Do you have any suggestion how to optimize this code part?
Sorry for my stupid questions, but I'm really new to C#. Am I right with this pairing:
XmlNodeList class -> should use SelectNodes
XmlNode class -> should use SelectSingleNode
?
Thank you