Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 

XML path error

Hi i am trying to load an xml and parse it to show a list of videos i get this error
*** ERROR: Invalid path: '<?xml version="1.0" encoding="UTF-8"?>
<rsp stat="ok">
<video>
<title>Remembering the 2010 Haiti Earthquake</title>
<description>In January of 2010, a devastating earthquake rocked Haiti, causing massive damage and loss of lifeDIDN'T PASS. . .


this is my code

http = CreateObject("roUrlTransfer")
http.SetUrl("http://roku.jjtdigital.net/salvation_army2/videos.xml")
xml=http.GetToString()
rsp=CreateObject("roXMLElement")
IF rsp.Parse(ReadAsciiFile(xml))
?"XML PARASED. . ."
m.options = []
videoinfo = []
For i= 0 to xml.video.count()-1
videoinfo={
Title: xml.video[i].title.GetText()
}
m.options.Push(videoinfo)
End For
?"PROGRAMLIST CREATED. . ."
?"PROGRAMLIST COUNT. . ."m.options.count()
else
?"DIDN'T PASS. . ."
END IF
0 Kudos
1 Reply
TheEndless
Level 7

Re: XML path error

The problem is this line:
IF rsp.Parse(ReadAsciiFile(xml))

ReadAsciiFile is intended for reading local text files into a string. You already have a string from your roUrlTransfer request. You also have your rsp and xml variables backwards. Change the first few lines to this, and you should be good...
   http = CreateObject("roUrlTransfer")
http.SetUrl("http://roku.jjtdigital.net/salvation_army2/videos.xml")
rsp = http.GetToString()
xml = CreateObject("roXMLElement")
If xml.Parse(rsp) Then
...
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos