XPath Extensions is cool!


I’m been using XDocument and it’s API for some time, but I wasn’t aware of an XPath Extensions in the .NET Framework. Thanks to my co-worker Lucy, she’s shared with me some good tips and in turn I’m sharing it with you.

Consider this XML.

<?xml version="1.0" encoding="utf-8" ?>
<Order>
 <Product id="1" name="Nexus 5">
 <Price>400.00</Price>
 <Qty>1</Qty>
 </Product>
 <Product id="5" name="Wireless Charger">
 <Price>50.00</Price>
 <Qty>1</Qty>
 </Product>
</Order>

This would have been typically how I would dig into the XML to find certain data using XDocument, in a safe way of course.

Read the rest of this entry »

Advertisements
Posted in C#. Tags: , . Leave a Comment »