Hi Jason,

On 13/04/2011, at 10:21 AM, ext Jason H wrote:

> I have:
> XmlListModel{ 
>   id: instanceModel
>   source: "getNextInstanceXml.php"
>   XmlRole{name:"paramList";query:"instance/paramList"}
> }
> 
> Where paramList looks like:
> <paramList>
> <param name="gradientStart" value="#000000"/>
> <param name="gradientStop" value="#FFFFFF"/>
> </paramList>


The gradientStart and gradientStop values won't be placed into the model unless 
XmlRole objects are specified for them, since the model won't know the 
structure of the data that is supposed to be retrieved.

I'd suggest something like this, which creates an XmlRole for each value:

    XmlListModel{ 
        id: instanceModel
        source: "getNextInstanceXml.php"
        query: "/paramList"
        XmlRole { name:"gradientStart"; query:"param[1]/@value/string()" }
        XmlRole { name:"gradientStop"; query:"param[2]/@value/string()" }
    }

Now if you examine instanceModel.get(0) it will look like:

{ "gradientStart": "#000000", "gradientStop": "#FFFFFF" }


regards,

Bea
_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt-qml

Reply via email to