Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

xml tags are not escaped

Help
aton
2010-03-16
2013-05-01
  • aton
    aton
    2010-03-16

    i am using the python bindings for obexftp to retrieve file listings from my mobile phone (motorola motozine zn5).

    everything works fine as long as i dont have files with xml special characters on my storage card. obexftp sends these filenames unescaped, killing the xml parser (lxml.etree).

    the xml code, thats causes the problem looks like this:
    <folder name="Scala_&_Kolacny_Brothers-Grenzenlos" size="32768" user-perm="RWD" created="20090718T193016Z" modified="20090718T193016Z" accessed="20090718T193016Z"/>

    As you can see, there is a & in the Filename, which cripples lxml:
    lxml.etree.XMLSyntaxError: EntityRef: expecting ';',

    it would be nice if these characters would be replaced by html entity codes or something else that is xml conform

     
  • Thanks for reporting this. You are right, unescaped XML special chars are not allowed (except for CDATA sections and comments). This is a bug in your motorola phone - the xml data is the output straight from the phone. Maybe I need to add a sanitizer for broken device stacks like that one.
    Is the python API designed/working as expected? There were no reports from python users in a long time.

     
  • aton
    aton
    2010-03-16

    thanks for the quick answer. adding sanitizers would be great.
    it works well so far, i just made a small tool to browse directories from a commandline, file up- and download will follow and perhaps recursiveness. i will post some more feedback when i used it a bit longer.

    hm i was thinking about returning my phone, now i have a serious reason :)