XML 2 Obect class usage and minor fix

posted by: seth :: Mar 29th 2006, 09:27

I was tooling around with John Grden's new XML2Object class but had an error with experimenting with an Odeo feed. The problem occurred when attempting to access the enclosure.url attribute in the xml below. It wasn't converting the enclosure node to an object because enclosure didn't have child nodes. I made a few changes to the class and things seem to be tracing better.

Here's the new class
Here's the rss feed

Here's how it's tracing:


  • rss = [object Object]

    • version = 2.0
    • xmlns:itunes = http://www.itunes.com/DTDs/Podcast-1.0.dtd
    • channel = [object Object]
      • item = [object Object]
        • itunes:author = geekinger
        • link = http://odeo.com/show/853902/view
        • description = undefined
        • pubDate = Thu, 09 Mar 2006 22:58:42 GMT
      • guid = [object Object]

        • isPermaLink = false

      • enclosure = [object Object]
        • length = 1
        • type = audio/mpeg
        • url = http://odeo.com/show/download/971166/1037965/media.odeo.com.files.u.6.t.draft71037out.mp3

    • title = Audio from geekinger (Mar 9, 2006)
      • itunes:image = [object Object]
      • href = http://media.odeo.com/images/default_icon.gif

    • ttl = 40
    • language = en-us
    • description = yeah thats me.
    • itunes:author = geekinger
    • link = http://odeo.com/
    • title = geekinger


Here's the path to the values.
(1233) channel.item.guid: [object Object]:
(1234) obj.rss.version: 2.0:
(1234) obj.rss.channel.enclosure.url:
http://odeo.com/show/download/971166/1037965/media.odeo.com.files.u.6.t.draft71037out.mp3:

2 comments

bottom

1. John Grden :: on Mar 29, 2006 Very nice Seth!
2. seth :: on Apr 03, 2006 thanks John! I'm now tackling the recursion problem...

add one

 
 
top