date: xml.myxmlfile[i]@start
title: xml.myxmlfile[i].title.gettext()
nameElements = xml.getNamedElements("display-name")
?nameElements[0].getText()
?nameElements[1].getText()
...
nameElements = xml.getNamedElements("display-name")
for i = 0 to xml.video.count()-1
videoinfo={
name: nameElements[i].gettext()
End for
for each video in xml.video
' get the display-name elements from the video node
nameElements = video.getNamedElements("display-name")
videoinfo = {
name: nameElements[0].gettext() ' Use 0 here, since you only want the first element.
}
' do something with your videoinfo object here (i.e., add it to an array)
end for
name: nameElements[0].gettext() ' Use 0 here, since you only want the first element
"btpoole" wrote:
Thanks again for the help but part of the code will not perform as desired.name: nameElements[0].gettext() ' Use 0 here, since you only want the first element
This does pull the first element but with each step thru the video in xml.video the first element in the nameElements has a different index number. So, trying to pull the first element for each <display-name> under each video requires the nameElements[] to have an increasing number. The code doesn't "reset" to [0] when a new video is reached, rather it keeps increasing, this is part of the reason I was using a For i= 0 to count, I was increasing the index for each nameElements which works but there is not way to determine where the first element in each video is located since there is not a set number of "display-name" elements in each video. I thought it would also pull just the first element under video with the code you provided and really not sure why it doesn't "reset" to 0 with each video.
We’re upgrading Roku Community to bring you a faster, more mobile-friendly experience. You may notice limited functionality or read-only access during this time. Read more here.
Planned Downtime:
Community will be unavailable for up to 24–48 hours during the upgrade window during the week of May 19th and you may notice reduced functionality.
In the meantime, for additional assistance, visit our Support Site.
We're sorry for this disruption — we’re excited to share what’s next!
For support, visit support.roku.com.