Home » Microsoft TechnologiesRSS

A little bit of If statements, some html investigating, and the webbrowser.

I have a code that retrieves all the "place names" and all the "addresses" separately in this link:

http://www.yellowpages.ca/search/si-geo/1/sh/Ottawa,+ON

I need to modify my code so that it will only retrieve the "placename" and "address" if

<div class="address""> is not found within <div class="listingDetail"">. 

 

Class="address" is the address of the location, class="listingDetail" is the parent, or container. Some screenshots, please view them for better understanding:

http://i52.tinypic.com/67moog.png

http://i55.tinypic.com/289f7n.png

 

4 Answers Found

 

Answer 1

You have " a code", hmmmm? What's stopping you from changing it? Did you write it yourself?

Renee

 

Answer 2

Yes I did. I didnt post it because it uses the HtmlAgilityPack, didnt want to confuse anyone. (see my other thread "Match 2 different string together" for the code). 

 

Whats stopping me from changing it? 

Im requesting help because I dont know how to go about doing it

 

 
 

Answer 4

Well I figured it out. Since "class=listingTitleLine" (placename) is a preceding sibling of "class=address" (address), all I needed to do was tell Xpath to get the preceding sibling of the address. 

 

("//div[@class='address']/preceding-sibling::h3[@class='listingTitleLine']")

 

-Dd,

 
 
 

<< Previous      Next >>


Microsoft   |   Windows   |   Visual Studio   |   Follow us on Twitter