Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
pixshatterer
Level 7

Scene Graph node fields valid values

Hi, I have been having a rough time trying to assign a valid value to a stringArray field from XML, so far trying something like:


<MyComp
 id="comp"
 messages="[hi, hello, world, none]"
/>



... but so far I always have this in the debugger:
Warnings occurred while creating XML component CarouselItem

-- Type mismatch occurred when setting the "messages" field of a "MyComp" node

... is there a way to set those values right?

It would be awesome if documentation had samples about valid values per field type!
0 Kudos
10 Replies
EnTerr
Level 8

Re: Scene Graph node fields valid values

You know what would be awesome-er? If the error message was showing what the expected type was!
I.e. is `messages` declared in <interface/>as "string" or what? (Apparently not string or it wouldn't object)

Welcome to XML world, where we always feed strings to the properties but make-believe they are something else! </sarcasm>
0 Kudos
TheEndless
Level 7

Re: Scene Graph node fields valid values

This this instead...
<MyComp
  id="comp"
  messages="['hi', 'hello', 'world', 'none']"
/>
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
EnTerr
Level 8

Re: Scene Graph node fields valid values

Pray tell - what field type would that be?  8) ah yes, made a fool of myself
0 Kudos
TheEndless
Level 7

Re: Scene Graph node fields valid values

"EnTerr" wrote:
Pray tell - what field type would that be?  8)

The OP said he was trying to set the value of a "stringarray" field.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
pixshatterer
Level 7

Re: Scene Graph node fields valid values

"TheEndless" wrote:
This this instead...
<MyComp
  id="comp"
  messages="['hi', 'hello', 'world', 'none']"
/>


I already tried, but it didn't work :\ so I went looking around if escaping quotes would work and it did, so this was the solution:

 
<MyComp
id="comp"
messages="[&quot;hi&quot;,&quot;hello&quot;,&quot;world&quot;,&quot;none&quot;]"
/>


... which looks awful, but so far looks like the only way :v 
0 Kudos
pixshatterer
Level 7

Re: Scene Graph node fields valid values

"TheEndless" wrote:
"EnTerr" wrote:
Pray tell - what field type would that be?  8)

The OP said he was trying to set the value of a "stringarray" field.

... and btw, I ran into another issue now: I wanted to pass uri in this format as it can be used in XML components  "pkg:/locale/whatever/$$RES$$/image.png" but now it doesn't resolve those.. is there an - maybe - obvious way to accomplish that?
0 Kudos
pixshatterer
Level 7

Re: Scene Graph node fields valid values

"EnTerr" wrote:
You know what would be awesome-er? If the error message was showing what the expected type was!
I.e. is `messages` declared in <interface/>as "string" or what? (Apparently not string or it wouldn't object)

Welcome to XML world, where we always feed strings to the properties but make-believe they are something else! </sarcasm>

...well, I think it was self explanatory when I wrote it:


Hi, I have been having a rough time trying to assign a valid value to a stringArray field...

... but I can be wrong Smiley Happy
0 Kudos
TheEndless
Level 7

Re: Scene Graph node fields valid values

"pixshatterer" wrote:

I already tried, but it didn't work :\ so I went looking around if escaping quotes would work and it did, so this was the solution:
<MyComp
id="comp"
messages="[&quot;hi&quot;,&quot;hello&quot;,&quot;world&quot;,&quot;none&quot;]"
/>

... which looks awful, but so far looks like the only way :v 

Eep!  Try flipping the quotes...
<MyComp
 id="comp"
 messages='["hi", "hello", "world", "none"]'
/>

XML supports single and double quotes interchangeably when wrapping attribute values.  Apparently the Roku SceneGraph parser doesn't...
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
pixshatterer
Level 7

Re: Scene Graph node fields valid values

"TheEndless" wrote:
"pixshatterer" wrote:

I already tried, but it didn't work :\ so I went looking around if escaping quotes would work and it did, so this was the solution:
<MyComp
id="comp"
messages="[&quot;hi&quot;,&quot;hello&quot;,&quot;world&quot;,&quot;none&quot;]"
/>

... which looks awful, but so far looks like the only way :v 

Eep!  Try flipping the quotes...
<MyComp
 id="comp"
 messages='["hi", "hello", "world", "none"]'
/>

XML supports single and double quotes interchangeably when wrapping attribute values.  Apparently the Roku SceneGraph parser doesn't...

Awesome! that worked! I'm familiar with the XML interchangeability of single/double quotes there, but after it failed when I tried the other way around  - as you suggested too - I gave up on that.

Thanks!
0 Kudos