Forum Discussion

xavierserranoa's avatar
11 years ago

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

1 Reply

  • 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
    ...