[SailfishDevel] Getting simple XML to show on the emulator

Jani Nuutinen amontieri at gmail.com
Tue May 12 20:10:19 UTC 2015


Hi Andrey and thanks for the quick reply!


Certainly I might then look into using JSON. It remains to be seen if I'll
be returning later on with a similar question but that time hand in hand
with JSON :)

Best regards


On Tue, May 12, 2015 at 10:59 PM, Andrey Kozhevnikov <coderusinbox at gmail.com
> wrote:

>  Using XML is not simplest for QML. Native data format for QML/JavaScript
> is JSON.
>
> 13.05.2015 00:58, Jani Nuutinen пишет:
>
> I'm trying early on to familiarize myself with passing data to the phone
> from the Internet and just for starters I chose to use a simple XML-file to
> see if I could make something out myself. I do not know if using XML from
> Internet source is the simplest or the smartest method, but trying to
> follow the scarce tutorials about passing XML data didn't seem to be that
> challenging.
>
>  Code:
>
>  import QtQuick 2.0
>
> import Sailfish.Silica 1.0
>
> import QtQuick.XmlListModel 2.0
>
> Page{
>
>     id: root
>
>     XmlListModel{
>
>         id:noteXml
>
>         source:"http://www.w3schools.com/xml/note.xml"
>
>         query:"/note"
>
>         XmlRole{name: "body"; query: "body/string()"}
>
>     }
>
>     SilicaListView{
>
>          id:noteView
>
>          width: parent.width
>
>          height: parent.height
>
>
>         anchors.centerIn: parent
>
>          header: PageHeader{
>
>              title: "Note"
>
>          }
>
>          model:noteXml
>
>          }
>
>     }
>
>  I've tried few other approaches but to me this seems the simplest method "coding wise". The app starts (in the emulator) as it should and without errors, showing the first page with *Note* as the title. But no matter how much I'd like the XML getting passed on to the phone screen from the provided URL it never does.
>
>  So I'm wondering what am I missing that should be included to get such a simple thing working?
>
>  Greetings
>
>  Asmodeus
>
>
>
> _______________________________________________
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to devel-unsubscribe at lists.sailfishos.org
>
>
>
> _______________________________________________
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to
> devel-unsubscribe at lists.sailfishos.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20150512/8a854e3b/attachment-0001.html>


More information about the Devel mailing list