How to get XML attributes default value when use XmlListModel / XmlRole.
-
Hi,I am try QML.
I have XML file .
<node value="1" />
<node value="2" option="x" />
<node value="3" />ListView use, the XML file.
@
model:XmlListModel{
......XmlRole { name:"mValue"; query:"@value/number()" }
XmlRole { name:"mOption"; query:"@option/string()" }
}
@I got Error....
ReferenceError: Can't find variable: mOptionI guess, anywhere have not default value of option attribute.
do you have same idea?
[edit] added code wrappings, koahnig
-
Can you show the bit of code producing the error? Note that the roles will only be available within a ListView delegate, so referencing them elsewhere might produce the type of error you are seeing.
Regards,
Michael -
Thinks for quick reply, Michael.
I noticed that the spelling is wrong When i check again,today.
and, XML Attributes is undefined, i confirmed the operation defaults to 0.
Thanks