[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-panel-devel
Subject:    Re: how do I deal with special characters?
From:       Eric Mesa <ericsbinaryworld () gmail ! com>
Date:       2012-10-27 12:00:19
Message-ID: CAKYHq8JU+8kA-cQOxYwwaTRb6rJLUHLY6TuzUnUzKuYuGiN_WA () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On Sat, Oct 27, 2012 at 2:56 AM, David Narvaez
<david.narvaez@computer.org>wrote:

> On Fri, Oct 26, 2012 at 8:07 PM, Eric Mesa <ericsbinaryworld@gmail.com>
> wrote:
> > So the input data looks like:
> > <photo><title>one side clear & one
> snowy</title><id>8441049</id><views>318</views><URL>
> http://www.flickr.com/photos/ericsbinaryworld/8441049/</URL><JPEG>
> farm1.staticflickr.com/8/8441049_6d70c1faac_m.jpg</JPEG></photo><
> >
> > There are plenty of non-alpha numeric characters that work, but
> apparently there is an issue with ampersands (&).  Perhaps I can just write
> some code to get rid of those.
>
> There's plenty of code that deals with that. In general, you never
> want to write XML without proper escaping first; in this case escaping
> could actually happen at the XmlListModel level. For a quick fix,
> escape all of the string() values below.
>
> > The function it's going into is:
> >
> >
> >  XmlListModel{
> >             id:feedModel
> >             xml:  window.currentGroup
> >             query: "/photos/photo"
> >             XmlRole { name: "title"; query: "title/string()"}
> >             XmlRole { name: "views"; query: "views/string()"}
> >             XmlRole { name: "url"; query: "URL/string()"}
> >             XmlRole { name: "jpeg"; query: "JPEG/string()"}
> >             XmlRole { name: "photo"; query: "id/string()"}
> >         }
>
> David E. Narvaez
> _______________________________________________
> Plasma-devel mailing list
> Plasma-devel@kde.org
> https://mail.kde.org/mailman/listinfo/plasma-devel
>
Ah, I see.  Good to know.  Thanks for that.  I tested the code yesterday
and it works.  The only bad thing is that it uses a deprecated function
that won't be in python 3 so I'll have to refigure it out once Python 2 is
gone.  (the code that feeds the data engine is python)
--
Eric Mesa
http://about.me/ericmesa
http://www.ericsbinaryworld.com

[Attachment #5 (text/html)]

<br>
<br><br><div class="gmail_quote">On Sat, Oct 27, 2012 at 2:56 AM, David Narvaez <span \
dir="ltr">&lt;<a href="mailto:david.narvaez@computer.org" \
target="_blank">david.narvaez@computer.org</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"> <div class="im">On Fri, Oct 26, 2012 at 8:07 PM, Eric Mesa \
&lt;<a href="mailto:ericsbinaryworld@gmail.com">ericsbinaryworld@gmail.com</a>&gt; \
wrote:<br> &gt; So the input data looks like:<br>
&gt; &lt;photo&gt;&lt;title&gt;one side clear &amp; one \
snowy&lt;/title&gt;&lt;id&gt;8441049&lt;/id&gt;&lt;views&gt;318&lt;/views&gt;&lt;URL&gt;<a \
href="http://www.flickr.com/photos/ericsbinaryworld/8441049/" \
target="_blank">http://www.flickr.com/photos/ericsbinaryworld/8441049/</a>&lt;/URL&gt;&lt;JPEG&gt;<a \
href="http://farm1.staticflickr.com/8/8441049_6d70c1faac_m.jpg" \
target="_blank">farm1.staticflickr.com/8/8441049_6d70c1faac_m.jpg</a>&lt;/JPEG&gt;&lt;/photo&gt;&lt;<br>


&gt;<br>
&gt; There are plenty of non-alpha numeric characters that work, but apparently there \
is an issue with ampersands (&amp;).  Perhaps I can just write some code to get rid \
of those.<br> <br>
</div>There&#39;s plenty of code that deals with that. In general, you never<br>
want to write XML without proper escaping first; in this case escaping<br>
could actually happen at the XmlListModel level. For a quick fix,<br>
escape all of the string() values below.<br>
<div class="im"><br>
&gt; The function it&#39;s going into is:<br>
&gt;<br>
&gt;<br>
&gt;  XmlListModel{<br>
&gt;             id:feedModel<br>
&gt;             xml:  window.currentGroup<br>
&gt;             query: &quot;/photos/photo&quot;<br>
&gt;             XmlRole { name: &quot;title&quot;; query: \
&quot;title/string()&quot;}<br> &gt;             XmlRole { name: &quot;views&quot;; \
query: &quot;views/string()&quot;}<br> &gt;             XmlRole { name: \
&quot;url&quot;; query: &quot;URL/string()&quot;}<br> &gt;             XmlRole { \
name: &quot;jpeg&quot;; query: &quot;JPEG/string()&quot;}<br> &gt;             \
XmlRole { name: &quot;photo&quot;; query: &quot;id/string()&quot;}<br> &gt;         \
}<br> <br>
</div>David E. Narvaez<br>
<div class="HOEnZb"><div \
class="h5">_______________________________________________<br> Plasma-devel mailing \
list<br> <a href="mailto:Plasma-devel@kde.org">Plasma-devel@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/plasma-devel" \
target="_blank">https://mail.kde.org/mailman/listinfo/plasma-devel</a><br> \
</div></div></blockquote></div>Ah, I see.  Good to know.  Thanks for that.  I tested \
the code yesterday  and it works.  The only bad thing is that it uses a deprecated \
function  that won&#39;t be in python 3 so I&#39;ll have to refigure it out once \
Python 2  is gone.  (the code that feeds the data engine is python)<br \
clear="all">--<br>Eric Mesa<div><a href="http://about.me/ericmesa" \
target="_blank">http://about.me/ericmesa</a><br><a \
href="http://www.ericsbinaryworld.com" \
target="_blank">http://www.ericsbinaryworld.com</a></div>



_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic