I am trying to create sections in a LabelList. Sections are created alright when I do it in init() method in BrightScript code like
m.settingsListContent = CreateObject("RoSGNode", "ContentNode")
m.settingsTree = {
"General": ["Subtitles"],
"Video Content": [],
"Social Media": [],
"Exit": []
}
m.sections = {}
for each section in m.settingsTree
m.sections[section] = m.settingsListContent.createChild("ContentNode")
m.sections[section].contenttype = "section"
m.sections[section].title = section
for each item in m.settingsTree[section]
sectionItem = m.sections[section].createChild("ContentNode")
sectionItem.title = item
end for
end for
m.settingsList.content = m.settingsListContent
But when I try to do something similar from XML, it does not work. XML is as follows
<children>
<LabelList id="settingsList">
<ContentNode role="content">
<ContentNode contenttype="section" title="General">
<ContentNode title="Subtitles" />
</ContentNode>
<ContentNode contenttype="section" title="Video Content">
</ContentNode>
<ContentNode contenttype="section" title="Social Media">
</ContentNode>
<ContentNode contenttype="section" title="Exit">
</ContentNode>
</ContentNode>
</LabelList>
</children>
I get the below error and ContentNode is treated as item ContentNode instead of section ContentNode.
Type mismatch occurred when setting the "contenttype" field of a "ContentNode" node at line 23 of file pkg:/components/settingslistpanel.xml
Why "contenttype" is not accepted is XML but is accepted in BrightScript?