XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 27th, 2012, 08:21 AM
tstolber tstolber is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: UK
Posts: 178 tstolber User rank is Private First Class (20 - 50 Reputation Level)tstolber User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 16 h 50 m 3 sec
Reputation Power: 10
ImportXML - XPath Query in Google Docs

Hi

I am developing some SEO tools and am using importXML and Xpath queries to pull the information I want.

(long time since I have posted here I'm an active member over on SEO Chat as tstolber)

Code:
=importxml(B1,"//div[@class='intro-box-wide']//li/a/@href")


Where B1 is the URL of the page I am analyzing. The final solution will be to pull specific data for multiple records returned from another function.

I am looking at URLs like
http://whois.domaintools.com/devshed.com

and I want to pull the following data from the code via import XML using the Xpath query. I am having trouble with getting the syntax right for Xpath.

I would like to get the IP address, country, city and network.

Code:
	<div id="ssTab-ipAddress" class="float-row display-input">
		<div class="add-to-my-whois" title="Add to My Whois" style="display:none;"><span onclick="addMyWhoisContent('ssTab-ipAddress','IP Address');"></span></div>
		<div class="form-label field-label wide-20"><span>IP Address:</span></div>
		<div class="form-field wide-80 normal">
	        <a class="left-pad-none bold" href="http://whois.domaintools.com/209.35.17.17">209.35.17.17</a>
	        <a class="left-pad-none horiz-marg-10" href="http://www.domaintools.com/research/reverse-ip/?hostname=209.35.17.17">Reverse-IP</a> |
	        <a class="left-pad-none horiz-marg-10" href="http://www.domaintools.com/research/ping/?query=209.35.17.17">Ping</a> |
	        <a class="left-pad-none horiz-marg-10" href="http://www.domaintools.com/research/dns/?query=209.35.17.17">DNS Lookup</a> |
	        <a class="left-pad-none horiz-marg-10" href="http://www.domaintools.com/research/traceroute/?query=209.35.17.17">Traceroute</a>
		</div>
	</div>


and

Code:
			<div id="ssTab-ipLocation" class="float-row display-input">
			<div class="add-to-my-whois" title="Add to My Whois" style="display:none;"><span onclick="addMyWhoisContent('ssTab-ipLocation','IP Location');"></span></div>
			<div class="form-label field-label wide-20"><span>IP Location:</span></div>
			<div class="form-field wide-80">
		        <img src="/images/flags/us.gif" alt="United States" height="12" width="18">
		        - Washington		        - Woodinville		        - Peer 1 Dedicated Hosting			</div>


I can see that the IP address is in an A element with the class "left-pad-none bold" and the country is in an IMG element within a DIV with the class "form-field wide-80" with the ALT text being the country name. Then the text immediately after that gives the city and then the network name of the hosting platform.

I am struggling to get the right syntax for the Xpath query. I have some XPath queries that work in my Import XML but I am really struggling to pull this data.

Any help is appreciated.

Thanks!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > ImportXML - XPath Query in Google Docs

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap