Re: Importing sticky ntoes



Il giorno dom, 13/11/2011 alle 19.50 +0200, Aurimas Černius ha scritto:
> Hi,
> 
> > > Can you provide the sample note that does not import?
> > 
> > Well, this is a sample stickynotes_applet file which will not import:
> > 
> > -----8<----------8<----------8<----------8<----------8<----------8<-----
> > <?xml version="1.0"?>
> > <stickynotes version="2.30.0">
> >   <note title="A" x="1" y="25" w="252" h="315">Pisa &lt;
> > Bologna:</note>
> > </stickynotes>
> > -----8<----------8<----------8<----------8<----------8<----------8<-----
> 
> &lt; is the '<' character, all sticky notes with '<' and '>' characters
> are not imported at present.
> 
> 
> > but will neiter raise any error. It will import regularly if I remove
> > the "&lt;" bit.
> > 
> > The following is an example which will raise the errors
> > "(140522793548160) ERROR: load_addins_for_note - trying to load addins
> > when they are already loaded
> > (140522793548160) ERROR: error_handler - XML error EntityRef: expecting
> > ';'" (and not import):
> > 
> > -----8<----------8<----------8<----------8<----------8<----------8<-----
> > <?xml version="1.0"?>
> > <stickynotes version="2.30.0">
> >   <note title="regali" x="1" y="25" w="289" h="340">example
> > http://www.example.com&amp;products_id=219
> > </note>
> > </stickynotes>
> > -----8<----------8<----------8<----------8<----------8<----------8<-----
> 
> This note contains &amp; - the '&' character. At present this is not
> checked before importing, that's why the error occurrs.
> 
> 
> > and finally, the following will raise the errors
> > "(140400014412160) ERROR: load_addins_for_note - trying to load addins
> > when they are already loaded
> > (140400014412160) ERROR: error_handler - XML error xmlParseEntityRef: no
> > name" and import an empty (but with the right title) note:
> > -----8<----------8<----------8<----------8<----------8<----------8<-----
> > <?xml version="1.0"?>
> > <stickynotes version="2.30.0">
> >   <note title="regali" x="1" y="25" w="289" h="340">example&amp;
> > </note>
> > </stickynotes>
> > -----8<----------8<----------8<----------8<----------8<----------8<-----
> 
> Same here - the '&amp;'.
> 
> 
> This is a bug. Gnote does allow special characters in notes, but
> currently this is not the case for sticky note importer.
> Thanks for reporting this.

My pleasure.

There may be other problems, but I cannot send you the whole
stickynotes_applet file. If you want to send me your patch fixing these,
I'll be happy to beta test it.

By the way, I guess the problem is around line 297 of
stickynoteimportnoteaddin.cpp:

  std::string noteXml = str(boost::format("<note-content><note-title>%
1%</note-title>\n\n"
                               "%2%</note-content>") % title % content);

which makes libxml2 reparse already parsed xml.
If what I just wrote is not plainly stupid, then maybe the cleanest
solution would be to parse the stickynotes file without considering it
xml (i.e. as regexps), extract notes bodies and _then_ pass them as
"content"?

(I _would_ try to provide a patch if I was not a zero in C++)

Pietro



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]