Pradeep Kumar
Pradeep Kumar

Reputation: 399

Connecting xml to roku

I am New to ROKU... i have a grid screen. and i want to connect xml to this grid in a simple way. how can i connect that?

please help me i am struck my xml looks like:

<video>
<ChannelTitle>A TV</ChannelTitle>
<LikesCount>0</LikesCount>
<Thumbnail/>
<VideoTitle>Archive_20130408_15.17.45.asf111111</VideoTitle>
<Videosource/>
<ViewsCount>0</ViewsCount>
</video>
<video>
<ChannelTitle>A TV</ChannelTitle>
<LikesCount>0</LikesCount>
<Thumbnail/>
<VideoTitle>Prash</VideoTitle>
<Videosource>source</Videosource>
<ViewsCount>0</ViewsCount>
</video>
<video>
<ChannelTitle>A TV</ChannelTitle>
<LikesCount>1</LikesCount>
<Thumbnail>ChildrenMuseum_Thumb.jpg</Thumbnail>
<VideoTitle>2012 07 03 4 32 pm.mp4</VideoTitle>
<Videosource>ChildrenMuseum.ism</Videosource>
<ViewsCount>39</ViewsCount>
</video>
<video>
<ChannelTitle>A TV</ChannelTitle>
<LikesCount>0</LikesCount>
<Thumbnail/>
<VideoTitle>Archive_20130406_11.55.48.asf</VideoTitle>
<Videosource/>
<ViewsCount>0</ViewsCount>
</video>
<video>
<ChannelTitle>A TV</ChannelTitle>
<LikesCount>0</LikesCount>
<Thumbnail/>
<VideoTitle>Archive_20130408_15.31.14.asf</VideoTitle>
<Videosource/>
<ViewsCount>0</ViewsCount>
</video>
<video>
<ChannelTitle>A TV</ChannelTitle>
<LikesCount>0</LikesCount>
<Thumbnail/>
<VideoTitle>Amber_10.wmv</VideoTitle>
<Videosource/>
<ViewsCount>10</ViewsCount>
</video>
<video>
<ChannelTitle>A TV</ChannelTitle>
<LikesCount>1</LikesCount>
<Thumbnail>10Little Numbers_18_Thumb.jpg</Thumbnail>
<VideoTitle>ABCAlphabetTrain.mov</VideoTitle>
<Videosource>10Little Numbers_18.ism</Videosource>
<ViewsCount>34</ViewsCount>
</video>
<video>
<ChannelTitle>B TV</ChannelTitle>
<LikesCount>0</LikesCount>
<Thumbnail/>
<VideoTitle>Archive_20130409_10.57.20.asf</VideoTitle>
<Videosource>source</Videosource>
<ViewsCount>0</ViewsCount>
</video>
<video>
<ChannelTitle>B TV</ChannelTitle>
<LikesCount>0</LikesCount>
<Thumbnail>Parrots_1_Thumb.jpg</Thumbnail>
<VideoTitle>MrsEppsTeacherOfYear_Thumb.mp4</VideoTitle>
<Videosource>Parrots_1.ism</Videosource>
<ViewsCount>9</ViewsCount>
</video>
<video>
<ChannelTitle>B TV</ChannelTitle>
<LikesCount>0</LikesCount>
<Thumbnail/>
<VideoTitle>test121.ts</VideoTitle>
<Videosource/>
<ViewsCount>0</ViewsCount>
</video>
<video>
<ChannelTitle>B TV</ChannelTitle>
<LikesCount>0</LikesCount>
<Thumbnail/>
<VideoTitle>123_test_Archive_20130412_17.17.45.asf</VideoTitle>
<Videosource>source</Videosource>
<ViewsCount>0</ViewsCount>
</video>
<video>
<ChannelTitle>B TV</ChannelTitle>
<LikesCount>0</LikesCount>
<Thumbnail>Encoder1-868000_39_Thumb.jpg</Thumbnail>
<VideoTitle>testedit1.ts</VideoTitle>
<Videosource>Encoder1-868000_39.ism</Videosource>
<ViewsCount>0</ViewsCount>
</video>
<video>
<ChannelTitle>B TV</ChannelTitle>
<LikesCount>0</LikesCount>
<Thumbnail/>
<VideoTitle>Archive_20130410_14.36.02.asf</VideoTitle>
<Videosource>source</Videosource>
<ViewsCount>0</ViewsCount>
</video>
<video>
<ChannelTitle>B TV</ChannelTitle>
<LikesCount>0</LikesCount>
<Thumbnail/>
<VideoTitle>Archive_20130409_10.52.28.asf</VideoTitle>
<Videosource/>
<ViewsCount>0</ViewsCount>
</video>
<video>
<ChannelTitle>B TV</ChannelTitle>
<LikesCount>0</LikesCount>
<Thumbnail/>
<VideoTitle>Archive_20130410_11.19.35555555555.asf</VideoTitle>
<Videosource/>
<ViewsCount>0</ViewsCount>
</video>
<video>
<ChannelTitle>C TV</ChannelTitle>
<LikesCount>0</LikesCount>
<Thumbnail>Christmas_holidays_1_Thumb.jpg</Thumbnail>
<VideoTitle>Christmas_holidays_1.mp4</VideoTitle>
<Videosource>Christmas_holidays_1.ism</Videosource>
<ViewsCount>7</ViewsCount>
</video>
<video>
<ChannelTitle>C TV</ChannelTitle>
<LikesCount>0</LikesCount>
<Thumbnail/>
<VideoTitle>Archive_20130408_18.31.52.asf</VideoTitle>
<Videosource>source</Videosource>
<ViewsCount>13</ViewsCount>
</video>
<video>
<ChannelTitle>G TV</ChannelTitle>
<LikesCount>0</LikesCount>
<Thumbnail>Christmas_holidays_14_Thumb.jpg</Thumbnail>
<VideoTitle>2012 Tennis sudhakar test.mp4</VideoTitle>
<Videosource>Christmas_holidays_14.ism</Videosource>
<ViewsCount>96</ViewsCount>
</video>
<video>

Upvotes: 1

Views: 1226

Answers (3)

Nikunj Chaklasiya
Nikunj Chaklasiya

Reputation: 818

Here the XML Component OverView (Component for Roku desiging) : https://developer.roku.com/en-gb/docs/developer-program/core-concepts/xml-components/overview.md

Content metadata Reference (Component for External Control) : https://developer.roku.com/en-gb/docs/developer-program/getting-started/architecture/content-metadata.md

sub init()
  m.top.functionName = "getcontent"
 end sub

sub getcontent()

  content = createObject("roSGNode", "ContentNode")
  contentxml = createObject("roXMLElement")

  if m.top.contenturi.left(4) = "http"
      readInternet = createObject("roUrlTransfer")
      readInternet.setUrl(m.top.contenturi) 'here give XML path
      contentxml.parse(readInternet.GetToString()) 'parse string from XML his load from browser
  else
       print "Read Asciifile call...."
  end if    

  if contentxml.getName()="Content"

    for each video in contentxml.GetNamedElements("video") 'here element tag is video
      itemcontent = content.createChild("ContentNode")
      itemcontent.setFields(video.getAttributes())
    end for       

  end if

  m.top.content = content

end sub

Upvotes: 0

Akshat Agarwal
Akshat Agarwal

Reputation: 2847

I am assuming you have a grid screen in say XML 1. And you created a component for the grid in XML 2, and now you want to see this XML 2 component in your grid screen defined in XML 1.

In XML 1, where you defined you grid, add the tag

itemComponentName="XML2" 'Where XML2 is the name of XML 2 where you defined the component for grid item

to the grid node

Ref - http://sdkdocs.roku.com/display/sdkdoc/BrightScript+Language+Reference#BrightScriptLanguageReference-45BrightScriptXMLSupport

Upvotes: 0

goelze
goelze

Reputation: 508

As a start you should take a look at the Roku SDK Documentation, this link is specifically for XML Support on Roku:

http://sdkdocs.roku.com/display/sdkdoc/BrightScript+Language+Reference#BrightScriptLanguageReference-45BrightScriptXMLSupport

Also, in order for the Roku to be able to parse XML, the XML content must be inside a <rsp stat="ok"></rsp> tag.

You also want to look at the documentation for the Grid screen:

http://sdkdocs.roku.com/display/sdkdoc/roGridScreen

Upvotes: 3

Related Questions