HighDots Forums  

Hpricot xpath help

Ruby On Rails Talk Ruby On Rails programming language mailing list


Discuss Hpricot xpath help in the Ruby On Rails Talk forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
eggie5
 
Posts: n/a

Default Hpricot xpath help - 11-04-2009 , 10:15 PM






I have this XML:

<?xml version="1.0" encoding="UTF-8"?>
<dataroot xmlnsd="urn:schemas-microsoft-comfficedata"
generated="2009-11-04T16:45:18">
<Week>
<weekID>111</weekID>
<weekDuration>2009-03-02 - 2009-03-08</weekDuration>
<dateStamp>2009-03-08T00:00:00</dateStamp>
</Week>
<Week>
<weekID>113</weekID>
<weekDuration>2009-02-16 - 2009-02-22</weekDuration>
<dateStamp>2009-02-22T00:00:00</dateStamp>
</Week>
..
..
..


I want to parse out the Week element with the weekID of 111.
I'm using Hpricot and this but I can't find it. What's the xpath?
doc.search('//Week[weekID=111]')
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk (AT) googlegroups (DOT) com
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe (AT) googlegroups (DOT) com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply With Quote
  #2  
Old   
Conrad Taylor
 
Posts: n/a

Default Re: Hpricot xpath help - 11-05-2009 , 12:06 AM






On Wed, Nov 4, 2009 at 7:15 PM, eggie5 <eggie5 (AT) gmail (DOT) com> wrote:

Quote:
I have this XML:

?xml version="1.0" encoding="UTF-8"?
dataroot xmlnsd="urn:schemas-microsoft-comfficedata"
generated="2009-11-04T16:45:18"
Week
weekID>111</weekID
weekDuration>2009-03-02 - 2009-03-08</weekDuration
dateStamp>2009-03-08T00:00:00</dateStamp
/Week
Week
weekID>113</weekID
weekDuration>2009-02-16 - 2009-02-22</weekDuration
dateStamp>2009-02-22T00:00:00</dateStamp
/Week
.
.
.


I want to parse out the Week element with the weekID of 111.
I'm using Hpricot and this but I can't find it. What's the xpath?
doc.search('//Week[weekID=111]')

What's the issue?

-Conrad


Quote:

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk (AT) googlegroups (DOT) com
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe (AT) googlegroups (DOT) com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply With Quote
Reply




Thread Tools
Display Modes

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



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.