Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
360tv
Streaming Star

This XML parse / array push was working last night...

I've been pluggin away at all this stuff, everything was working wonderfuly. We've all been there... we make some change somewhere and we don't know what change you made that broke something, but you broke something...

so I'm running this function...

Function InitContentList() as object
list = CreateObject("roAssociativeArray")

xfer=createobject("rourltransfer")
xfer.seturl("[site]")
print "Getting Content from " + m.contentlist + "?" + "DeviceID=" + GetDeviceESN() + "&regtoken=" + loadRegistrationToken()
RawXMLData=xfer.gettostring()
PRINT RAWXMLDATA
xml=createobject("roXMLElement")
contentlist = []

if xml.parse(RawXMLData) then
for each obj in xml.item


contentlist.push({
title: obj.title.gettext()
id: obj.id.gettext()
SDBackgroundImageUrl: obj.SDBackgroundImageUrl.gettext()
HDBackgroundImageUrl: obj.HDBackgroundImageUrl.gettext()
ShortDescriptionLine1: obj.ShortDescriptionLine1.gettext()
ShortDescriptionLine2: obj.ShortDescriptionLine2.gettext()
function: obj.function.gettext()
url: obj.url.gettext()
par: obj.par.gettext()
register: obj.register.gettext()


})

print obj.title.gettext()
print obj.ID.gettext()
print obj.SDBackgroundImageUrl.gettext()
print obj.HDBackgroundImageUrl.gettext()
print obj.ShortDescriptionLine1.gettext()
print obj.ShortDescriptionLine2.gettext()
print obj.function.gettext()
print obj.url.gettext()
print obj.par.gettext()
print obj.register.gettext()
next


else
ShowDialog1Button("SORRY!", "Currently a problem with our servers. Please try again later.", "OK")
print "parse failed"
end if

'printAA(contentlist)
'printAA(contentlist[0])

return contentlist

End Function


PRINT RAWXMLDATA prints the XML in it's entirety. No problem.
print obj. works for each and gives me what should be there each time around.
when I printAA, I get "Nothing from for each. Looks like :?roFunction?"
when I printAA[0]... which worked before, It would print that array index no problem. now when I do it, I get Array operation attempted on variable not DIM'd. (runtime error &he7)
using contentlist = CreateObject("roArray", 100, true) or contentlist = [] returns same result (what's the difference anyhow? curious.)
0 Kudos
2 REPLIES 2
RokuMarkn
Visitor

Re: This XML parse / array push was working last night...

You might try printing type(contentlist). You don't happen to have a function called contentlist, do you?

--Mark
0 Kudos
360tv
Streaming Star

Re: This XML parse / array push was working last night...

Oh my god.... Yes....
You nailed it.

I DID add a function last night called contentlist(). Renamed it, it's working again.
In hindsight using the same names for functions and variables seems like it'd be a bad idea anyway.
0 Kudos