XML Question

I hate it when people do that...

1) What did you figure out?
2) Could you also post the solution so that someone else who may be having the same problem might benefit from this as well?

-tg
 
Sorry about that. I had an XML file that contained a path to an MP3 file that changes weekly. I needed to get that path and use it in the Media Player Control on my form. The problem was that the path in the XML was improperly formed (no closing tag) so I found another tag that contained the file name and appended that to the path (which never changes). I was just trying to find a shorter way. Here is the path to the XML:

http://www.arrl.org/arrlletter/audio/aan.rss

There is a line that says:

<enclosure url="http://www.arrl.org/arrlletter/audio/arrl/aan0916.mp3" length="1867915" type="audio/mpeg" />

I just need the path, but I couldn't get it, so I used:

<guid isPermaLink="false">aan0916h.mp3-1126910396</guid>

Stripped the last 11 characters and appended that to a the path. Here's the code:

Dim xmldoc AsNew XmlDocument

Dim Address AsString = "http://www.arrl.org/arrlletter/audio/arrl/"

xmldoc.Load("http://arrl.org/arrlletter/audio/aan.rss")

Dim nodelist As XmlNodeList

Dim nodes As XmlNode

nodelist = xmldoc.GetElementsByTagName("guid")

ForEach nodes In nodelist

txtFile.Text = (Address & nodes.InnerText.Remove(12, 11))

Next

AxWMP_ARRL.URL = txtFile.Text


Sorry for changing the post, I wanted to delete it before anyone responded, but couldn't find a way...I won't do it again.

Jason
 
Back
Top