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!

You know what would be awesome-er? If the error message was showing what the expected type was!
I.e. is messages declared in 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!

This this instead…

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

~~Pray tell - what field type would that be? :smiling_face_with_sunglasses: ~~ah yes, made a fool of myself

“EnTerr” wrote:
Pray tell - what field type would that be? :smiling_face_with_sunglasses:
The OP said he was trying to set the value of a “stringarray” field.

“TheEndless” wrote:
This this instead…


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

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

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

“TheEndless” wrote:

“EnTerr” wrote:
Pray tell - what field type would that be? :smiling_face_with_sunglasses:
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?

“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
…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 :slightly_smiling_face:

“pixshatterer” wrote:

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


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…

“TheEndless” wrote:

“pixshatterer” wrote:

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


Eep! Try flipping the quotes…


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!

Oh, right. This is because we have a turducken (turd-yuck-eh?), BrightScript literal stuffed inside XML attribute

Also, the xmLOLogy field parser “thinks different”.
Often wrongly: https://forums.roku.com/viewtopic.php?f=34&t=96411