I am scrolling thorugh my XML and having hit a RoadBlock. My issue is i have a XML doc of a product which has several features. So i traverse throught the features in this way.
XmlNodeList nodelist = XMLdoc.SelectNodes("//ProductFeature");
foreach (XmlNode singlenode in nodelist)
{
Presentation_Value = singlenode.Attributes["Presentation_Value"].InnerText;
}
Now the single node has this XML for all the nodes except one.
<ProductFeature Localized="0" ID="149991561" Local_ID="0" Value="8 - 80" CategoryFeature_ID="12224" CategoryFeatureGroup_ID="2698" No="100033" Presentation_Value="8 - 80%" Translated="0" Mandatory="0" Searchable="0">
The last node has this XML
<ProductFeature Localized="0" ID="149812647" Local_ID="0" Value="abc.biz" CategoryFeature_ID="33538" CategoryFeatureGroup_ID="10889" No="0" Translated="1" Mandatory="0" Searchable="0">
Since the Last node does not have the attribute "Presentation_Value" I get the Infamous error below
Object reference not set to an instance of an object.
How can i resolve this?