How to get xpath with indexing to update XML file dynamically C#
₹600-1500 INR
Cancelado
Publicado hace casi 6 años
₹600-1500 INR
Pagado a la entrega
I would like to know how to get xpath with indexing in c# dynamically .
XML FILE
<?xml version="1.0" encoding="UTF-8"?>
<breakfast_menu>
<food>
<name>Belgian Waffles</name>
<price>5.95</price>
<price>7.5</price>
<price>9.9</price>
<description>
Two of our famous Belgian Waffles with plenty of real maple syrup
</description>
<calories>650</calories>
</food>
<food>
<name>Strawberry Belgian Waffles</name>
<name>Strawberry Belgian Waffles Mini</name>
<name>Strawberry Belgian Waffles Full</name>
<price>7.95</price>
<description>
Light Belgian waffles covered with strawberries and whipped cream
</description>
<calories>700</calories>
</food>
<food>
<name>Berry-Berry Belgian Waffles</name>
<name>Berry-Berry Belgian Waffles Mini</name>
<name>Berry-Berry Belgian WafflesFull</name>
<price>8.95</price>
<description>
Belgian waffles covered with assorted fresh berries and whipped cream
</description>
<calories>900</calories>
</food>
<breakfast_menu>
MY output
Belgian Waffles my xPath== "breakfast_menu/food/name"
5.95 my xPath== "breakfast_menu/food/price"
7.5 my xPath== "breakfast_menu/food/price"
9.9 my xPath== "breakfast_menu/food/price"
Strawberry Belgian Waffles my xPath== "breakfast_menu/food/name"
Strawberry Belgian Waffles Mini my xPath== "breakfast_menu/food/name"
Strawberry Belgian Waffles Full my xPath== "breakfast_menu/food/name"
I want output like this
Belgian Waffles my xPath== "breakfast_menu/food[1]/name"
5.95 my xPath== "breakfast_menu/food/price[1]"
7.5 my xPath== "breakfast_menu/food/price[2]"
9.9 my xPath== "breakfast_menu/food/price[3]"
Strawberry Belgian Waffles my xPath== "breakfast_menu/food[2]/name[1]"
Strawberry Belgian Waffles Mini my xPath== "breakfast_menu/food[2]/name[2]"
Strawberry Belgian Waffles Full my xPath== "breakfast_menu/food[2]/name[3]"