I have a REST web service that creates a XMLDocument I am a bit confused on how access the inner text in FormattedPrice using XMLNode. I can grad offers but that will give me all the inner text.
<Offers>
<Offer>
<OfferListing>
<Price>
<Amount>1067</Amount>
<CurrencyCode>USD</CurrencyCode>
<FormattedPrice>$10.67</FormattedPrice>
</Price>
</OfferListing>
</Offer>
</Offers>
A quick walk-through of XPath will help immensely if you're using the Xml DOM.
This should meet your immediate need:
XmlNode n = doc.DocumentElement.SelectSingleNode("Offer/OfferListing/Price/FormattedPrice");
That will get you the first Offer's Formatted price (and assumes that your Offers node is the root). Other mechanisms exist in XPath that are a bit less brittle and that's where a tutorial would help you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With