Reputation: 10694
Hello I am working on XmlDocument retrieval
part of my document is
<Product ID="102166">
<Name>Name1</Name>
<Mrp>220.0000</Mrp>
<Price>210.2800</Price>
<Cost>177.8700</Cost>
<Barcode>102166,10216610,8901786409990,9910216600011,10216620,9910216600202
</Barcode>
</Product>
I want to select single product node from document whose itemcode inner text contains given string
e.g If I give 8901786409990 as input output should be its parent i.e. Product with ID 102166
I have tried following with no success
string ItemCode="8901786409990 ";
XmlNode node = doc.SelectSingleNode("/*/b:Product[contains(b:Barcode,'" + Itemcode1 + "')");
It throws exception '/*/b:Product[contains(b:,'8901786409990')'
has an invalid token.
Any Help?
Upvotes: 1
Views: 3580
Reputation: 70152
You are missing a close bracket:
string ItemCode="8901786409990 ";
XmlNode node = doc.SelectSingleNode("/*/b:Product[contains(b:Barcode,'" + Itemcode1 + "')]");
See the extra bracket here:
'/*/b:Product[contains(b:,'8901786409990')]'
Upvotes: 3