Link to home
Start Free TrialLog in
Avatar of bob1barker
bob1barkerFlag for Afghanistan

asked on

c# MLS Parsing, empty value error

I am parsing an XML file on the fly to show a single value inside the XML file. The code I have works great until we find a record that has no value in the xml file.  I have tried a few things to make it only show up if there was a value but I haven't been able to figure it out.

any thoughts?

you can test it by changing the XML URL to a fake address and you will see the value I am using disappear.


XmlDocument doc = new XmlDocument();
        string varURL = "http://www.zillow.com/webservice/GetSearchResults.htm?zws-id=X1-ZWz1cwo6lcszyj_aui2x&address=12598+Dupont+Drive&citystatezip=Rancho+Cucamonga+91739";
        doc.Load(Server.UrlPathEncode(varURL));

        XmlNode root = doc.DocumentElement;
        ZEstimate.Text = root.SelectSingleNode("//response/results/result/zpid").ChildNodes[0].Value;
ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bob1barker

ASKER

Worked Perfect
thanks
Not a problem, glad to help.  ;=)