1

我是 ROKU 的新手……我有一个网格屏幕。我想以一种简单的方式将 xml 连接到这个网格。我该如何连接?

请帮助我,我很震惊我的 xml 看起来像:

<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>
4

3 回答 3

3

首先,您应该查看 Roku SDK 文档,此链接专门用于 Roku 上的 XML 支持:

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

此外,为了使 Roku 能够解析 XML,XML 内容必须位于<rsp stat="ok"></rsp>标签内。

您还想查看 Grid 屏幕的文档:

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

于 2013-07-22T22:58:16.730 回答
0

这里是 XML 组件概览(Roku 设计的组件): https ://developer.roku.com/en-gb/docs/developer-program/core-concepts/xml-components/overview.md

内容元数据参考(外部控制组件):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
于 2019-06-12T09:33:36.210 回答
0

我假设您在 XML 1 中有一个网格屏幕。并且您在 XML 2 中为网格创建了一个组件,现在您希望在 XML 1 中定义的网格屏幕中看到这个 XML 2 组件。

在您定义网格的 XML 1 中,添加标记

itemComponentName="XML2" '其中 XML2 是您为网格项定义组件的 XML 2 的名称

到网格节点

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

于 2015-09-24T14:21:53.433 回答