Hello i am trying to retrieve node by its innertext. I want to get Product node of which child text should match input
<Order id="123">
<Product>
<Sku>110313</Sku>
<Name>Name1</Name>
<Quantity>1</Quantity>
</Product>
<Product>
<Sku>112985</Sku>
<Name>Name2</Name>
<Quantity>1</Quantity>
</Product>
</Order>
Now if i provide input as 110313 output should be First Product Node
I have tried so far
XmlNode orderNode = orderDoc.SelectSingleNode("//Order[@Id='" + textBox1.Text + "']");
XmlNode skuNode = orderNode.SelectSingleNode("/Product/Sku[text()='" + txt_barcode.Text + "']");
But its showing SKU as null. I have passed correct input.
Any Help
Use this selector:
/Order/Product[Sku=110313]
XmlNode skuNode = orderNode.SelectSingleNode(/Order/Product[Sku=" + txt_barcode.Text + "]");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.