468,483 Members | 2,514 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,483 developers. It's quick & easy.

Help returning the correct item from an RSS feed that has Attributes

DTeCH
23
Hi,


I'm trying to parse data from an RSS feed, but ever since they added attributes with more than one thingy in the line that i'm trying to parse, I've been stumped.


I mean I figured it out to this point:
Expand|Select|Wrap|Line Numbers
  1. 'i.ToString is the index of the current Item being parsed
  2. xSize = Rsss1.GetProperty("item[" & i.ToString & "]/newznab:attr[2]@value")
  3.  
parsing from...
Expand|Select|Wrap|Line Numbers
  1. <item>
  2.     <title>Super.Awesome.Movie.2012.DBRip</title>
  3.     <guid isPermaLink="false">77428c576538422</guid>
  4.     <link>Long Long Link :)</link>
  5.     <comments>Some_Link#comments</comments>     
  6.     <pubDate>Mon, 16 Jul 2012 21:51:33 +0000</pubDate> 
  7.     <category>Movies</category>     
  8.     <description>Totally awesome flick!!!  lol</description>
  9.     <enclosure url="http://LongURL" length="14174679056" type="application/x-nzb" />
  10.  
  11.     <newznab:attr name="category" value="2000" />
  12.     <newznab:attr name="category" value="2060" />
  13.     <newznab:attr name="size" value="14174679056" />
  14.     <newznab:attr name="files" value="102" />
  15.     <newznab:attr name="poster" value="hihi &lt;hihi@kere.ws&gt;" />
  16.     <newznab:attr name="genre" value="Crime|Drama|Mystery|Thriller" />
  17.     <newznab:attr name="grabs" value="2" />
  18.     <newznab:attr name="comments" value="0" />
  19.     <newznab:attr name="password" value="0" />
  20.     <newznab:attr name="usenetdate" value="Mon, 16 Jul 2012 21:49:50 +0000" />    
  21.     <newznab:attr name="group" value="alt.binaries.mom" />
  22.  
  23. </item>
  24.  
That does the job IF the number of properties are constant for each Item block in the RSS thingy.


What I want to do is be able to grab... let's say, Mon, 16 Jul 2012 21:49:50 +0000 from:
Expand|Select|Wrap|Line Numbers
  1.     <newznab:attr name="category" value="2000" />
  2.     <newznab:attr name="category" value="2060" />
  3.     <newznab:attr name="size" value="14174679056" />
  4.     <newznab:attr name="files" value="102" />
  5.     <newznab:attr name="poster" value="hihi &lt;hihi@kere.ws&gt;" />
  6.     <newznab:attr name="genre" value="Crime|Drama|Mystery|Thriller" />
  7.     <newznab:attr name="grabs" value="2" />
  8.     <newznab:attr name="comments" value="0" />
  9.     <newznab:attr name="password" value="0" />
  10.     <newznab:attr name="usenetdate" value="Mon, 16 Jul 2012 21:49:50 +0000" />    
  11.     <newznab:attr name="group" value="alt.binaries.mom" />
  12.  
The entry with usenetdate is what I need to get at no matter where it is in the list... I say this because the way I'm doing it now works until an extra entry is entered, or removed from one of the Items in the feed, & throws the index position off for every Item in the feed. So... the following no longer works because of it:
Expand|Select|Wrap|Line Numbers
  1. 'i.ToString is the index of the current Item being parsed
  2. xSize = Rsss1.GetProperty("item[" & i.ToString & "]/newznab:attr[2]@value")
  3.  
I don't know what to search for in Google, or what element/format/or whatever I'm talking about is, or is called. No clue about format, or whatever.

Please point your flashlights on this situation for me. I need to be slapped in the right direction because I'm lost right now. :)

Just show me a format, or something that i can replace what I have right now with... like from:

Expand|Select|Wrap|Line Numbers
  1. xSize = Rsss1.GetProperty("item[" & i.ToString & "]/newznab:attr[2]@value")
  2.  
to...
Expand|Select|Wrap|Line Numbers
  1. xSize = Rsss1.GetProperty("item[" & i.ToString & "]/newznab:attr/name:size@value")
  2. (I haven't got the slightest clue about how to give an example of what to change it to!  lol)
  3.  


ps: The component I'm using (Rsss1) is a paid component from nSoftware.com IPWorks SSL V8 (.NET Edition) that accepts XPath?, or whatever else... it just works with whatever I put into the GetProperty part of it. I just don't know how to deal with atributes in the above format of the feed to know what to enter next.

All help will be greatly appreciated.











#################################




Ok... this is the longest I've ever waited for an answer on Bytes.com... let me try to ask a different way.

I would like to get the contents of "value" where "name" is equal to "usenetdate"... but without using indexes, because the index will not be the same for each item block of the RSS feed.
Expand|Select|Wrap|Line Numbers
  1.  
  2. <item>
  3.         <newznab:attr name="category" value="2000" />
  4.         <newznab:attr name="category" value="2060" />
  5.         <newznab:attr name="size" value="14174679056" />
  6.         <newznab:attr name="files" value="102" />
  7.         <newznab:attr name="poster" value="hihi &lt;hihi@kere.ws&gt;" />
  8.         <newznab:attr name="genre" value="Crime|Drama|Mystery|Thriller" />
  9.         <newznab:attr name="grabs" value="2" />
  10.         <newznab:attr name="comments" value="0" />
  11.         <newznab:attr name="password" value="0" />
  12.         <newznab:attr name="usenetdate" value="Mon, 16 Jul 2012 21:49:50 +0000" />    
  13.         <newznab:attr name="group" value="alt.binaries.mom" />
  14.  
  15.  
  16. </item>
  17.  
  18.  
  19.  
I currently use the following to get the info:
Expand|Select|Wrap|Line Numbers
  1. xDate = Rsss1.GetProperty("item[9]/newznab:attr[11]@value")
  2.  
...but I need another way that doesn't use [11], because the index will not be the same for the next item block.

I have tried:
Expand|Select|Wrap|Line Numbers
  1. xDate = Rsss1.GetProperty("item[9]/newznab:attr[@name='usenetdate']@value")
  2.  
...but that doesnt work either. Please help.

Thanks guys.
Jul 17 '12 #1
0 1386

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Paul T. Rong | last post: by
1 post views Thread by Carlo Marchesoni | last post: by
reply views Thread by banjolibrarian | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by kmladenovski | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.