<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Using XML is not simplest for QML. Native data format for
QML/JavaScript is JSON.<br>
<br>
<div class="moz-cite-prefix">13.05.2015 00:58, Jani Nuutinen пишет:<br>
</div>
<blockquote
cite="mid:CABKxMKOm8TdcsZRJHP=DtGJvjUsbv4Kc=GhXmPX0tD5Ebp-kmQ@mail.gmail.com"
type="cite">
<div dir="ltr">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.
<div><br>
</div>
<div>Code:</div>
<div><br>
</div>
<div>
<pre style="margin-top:0px;margin-bottom:0px"><pre style="margin-top:0px;margin-bottom:0px"><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,128,0)">import</span><span style="color:rgb(192,192,192)"> </span>QtQuick<span style="color:rgb(192,192,192)"> </span>2.0</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,128,0)">import</span><span style="color:rgb(192,192,192)"> </span>Sailfish.Silica<span style="color:rgb(192,192,192)"> </span>1.0</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,128,0)">import</span><span style="color:rgb(192,192,192)"> </span>QtQuick.XmlListModel<span style="color:rgb(192,192,192)"> </span>2.0</pre><pre style="margin-top:0px;margin-bottom:0px">
</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,0,128)">Page</span>{</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,0)">id</span>:<span style="color:rgb(192,192,192)"> </span><span style="font-style:italic;color:rgb(0,0,0)">root</span></pre><pre style="margin-top:0px;margin-bottom:0px">
</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">XmlListModel</span>{</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,0)">id</span>:<span style="font-style:italic;color:rgb(0,0,0)">noteXml</span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,0)">source</span>:<span style="color:rgb(0,128,0)">"<a moz-do-not-send="true" href="http://www.w3schools.com/xml/note.xml">http://www.w3schools.com/xml/note.xml</a>"</span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,0)">query</span>:<span style="color:rgb(0,128,0)">"/note"</span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0
,128)">XmlRole</span>{<span style="color:rgb(128,0,0)">name</span>:<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"body"</span>;<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,0)">query</span>:<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"body/string()"</span>}</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span>}</pre><pre style="margin-top:0px;margin-bottom:0px">
</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">SilicaListView</span>{</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,0)">id</span>:<span style="font-style:italic;color:rgb(0,0,0)">noteView</span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,0)">width</span>:<span style="color:rgb(192,192,192)"> </span><span style="font-style:italic;color:rgb(0,0,0)">parent</span>.width</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,0)">height</span>:<span style="color:rgb(192,192,192)"> </span><span style="font-style:italic;color:rgb(0,0,0)">parent</span>.height</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </
span><span style="color:rgb(128,0,0)">anchors.centerIn</span>:<span style="color:rgb(192,192,192)"> </span><span style="font-style:italic;color:rgb(0,0,0)">parent</span></pre><pre style="margin-top:0px;margin-bottom:0px">
</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,0)">header</span>:<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">PageHeader</span>{</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,0)">title</span>:<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"Note"</span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span>}</pre><pre style="margin-top:0px;margin-bottom:0px">
</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,0)">model</span>:<span style="font-style:italic;color:rgb(0,0,0)">noteXml</span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span>}</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span>}</pre></pre></pre>
<pre style="margin-top:0px;margin-bottom:0px">
</pre>
<pre style="margin-top:0px;margin-bottom:0px">
</pre>
<pre style="margin-top:0px;margin-bottom:0px">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 <i>Note</i> 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.</pre>
<pre style="margin-top:0px;margin-bottom:0px">
</pre>
<pre style="margin-top:0px;margin-bottom:0px">So I'm wondering what am I missing that should be included to get such a simple thing working?</pre>
<pre style="margin-top:0px;margin-bottom:0px">
</pre>
<pre style="margin-top:0px;margin-bottom:0px">
</pre>
<pre style="margin-top:0px;margin-bottom:0px">Greetings</pre>
<pre style="margin-top:0px;margin-bottom:0px">
</pre>
<pre style="margin-top:0px;margin-bottom:0px">Asmodeus</pre>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to <a class="moz-txt-link-abbreviated" href="mailto:devel-unsubscribe@lists.sailfishos.org">devel-unsubscribe@lists.sailfishos.org</a></pre>
</blockquote>
<br>
</body>
</html>