Details
-
Suggestion
-
Resolution: Unresolved
-
P3: Somewhat important
-
4.7.0, 5.0.0, 5.4.0 Beta
-
None
Description
Currently the XmlListModel is the only element available for reading XML data. This is useful for creating a model from XML data, but does not work well for nested XML list data (since this requires using nested XmlListModels) and also doesn't fit the task if the application only requires some piece of data from the XML, and not a complete model.
What would be useful is a XmlObject element or something similar that is like XmlListModel, but isn't a model. Instead, it creates a single object with properties created from the XML data.
E.g.
XmlObject {
id: xmlObj
xml: xmlDataString
}
var name = xmlObj.root.slideshow[0].name
Can also set query on it like XmlListModel:
XmlObject { id: xmlObj xml: xmlDataString query: "root/slideshow[0]" } var name = xmlObj.name
Could be used in combination with XmlListModel to read more complex models e.g.
XmlListModel { id: model source: "feed.xml" query: "/root/slideshow" XmlRole { name: "slides"; query: "slide" objectDefinition: XmlObject { xml: rawXml XmlProperty { query: "blah"; name: "propertyName"} } } }
Attachments
Issue Links
- relates to
-
QTBUG-13688 Support lists of lists in XmlListModel
- Open
- replaces
-
QTBUG-5761 Support complex roles in XmlListModel.
- Closed