<div dir="ltr">Hi Andrey and thanks for the quick reply!<div><br></div><div><br></div><div>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 :)</div><div><br></div><div>Best regards</div><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 12, 2015 at 10:59 PM, Andrey Kozhevnikov <span dir="ltr"><<a href="mailto:coderusinbox@gmail.com" target="_blank">coderusinbox@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
Using XML is not simplest for QML. Native data format for
QML/JavaScript is JSON.<br>
<br>
<div>13.05.2015 00:58, Jani Nuutinen пишет:<br>
</div>
<blockquote type="cite"><div><div>
<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 href="http://www.w3schools.com/xml/note.xml" target="_blank">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)">
<u></u><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></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></fieldset>
<br>
</div></div><pre>_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to <a href="mailto:devel-unsubscribe@lists.sailfishos.org" target="_blank">devel-unsubscribe@lists.sailfishos.org</a></pre>
</blockquote>
<br>
</div>
<br>_______________________________________________<br>
SailfishOS.org Devel mailing list<br>
To unsubscribe, please send a mail to <a href="mailto:devel-unsubscribe@lists.sailfishos.org" target="_blank">devel-unsubscribe@lists.sailfishos.org</a><br></blockquote></div><br></div></div></div>