I would like to get an attribute from my xml file. The attribute is on my root. See here an example:
<PriceList ID="003" xmlns="BLA">
<Items>
<Item ID="AAK0435">
<RetailPrice currency="EUR">1.6</RetailPrice>
</Item>
<Item ID="AAL0144">
<RetailPrice currency="EUR">1470</RetailPrice>
</Item>
</Items>
</PriceList>
I would like to get the attribute "ID" on the root. I have try something like this but he doesnt come into the foreach loop.
XPathDocument xPriceDocument = new XPathDocument(priceList.FullName, XmlSpace.None);
XPathNavigator xPriceNavigator = xPriceDocument.CreateNavigator();
foreach (XPathNavigator xPriceListIdNavigator in xPriceNavigator.Select("PriceList"))
{
priceListId = xPriceListIdNavigator.GetAttribute("ID", "");
}