Decoding a WBXML SyncML message from an S60 device

独自空忆成欢 提交于 2019-12-04 14:00:02

问题


I'm trying to decode a WBXML encoded SyncML message from a Nokia N95. My first attempt was to use the python pywbxml module which wraps calls to libwbxml. Decoding the message with this gave a lot of <unknown> tags and a big chunk of binary within a <Collection> tag. I tried running the contents of the <Collection> through by itself but it failed. Is there something I'm missing?

Also, does anyone know of a pure python implementation of a wbxml parser? Failing that a command line or online tool to decode these messages would be useful -- it would make it a lot easier for me to write my own...


回答1:


Funnily enough I've been working on the same problem. I'm about halfway through writing my own pure-Python WBXML parser, but it's not yet complete enough to be useful, and I have very little time to work on it right now.

Those <Unknown> tags might be because pywbxml / libwbxml doesn't have the right tag vocabulary loaded. WBXML represents tags by an index number to avoid transmitting the same tag name hundreds of times, and the table that maps index numbers to tag names has to be supplied separately from the WBXML document itself. From a vague glance at the libwbxml source it seems like libwbxml has a bunch of tag tables hard coded. It has tables for SyncML 1.0-1.2; I think my Nokia E71 sends SyncML 1.3 (if so, your N95 probably does too), which it looks like libwbxml doesn't support yet.

Getting it to work might be as simple as adding a SyncML 1.3 table to libwbxml. That said, last time I tried, pywbxml doesn't compile against the vanilla libwbxml source, so you have to apply some patches first... so "simple" may be a relative term.




回答2:


I ended up writing a python parser myself. I managed to do it by following the spec here: http://www.w3.org/TR/wbxml/

And then taking the code tables from the horde.org cvs.

The open mobile alliance's site and documentation are terrible, this was a very trying project :(




回答3:


I used pywbxml , Just needed one patch in pywbxml.pyx:

params.lang in function wbxml2xml around line 25 set to:

params.lang = WBXML_LANG_UNKNOWN

works like charm. Also changing base class for WBXMLParseError to exception helps:

class WBXMLParseError(Exception):


来源:https://stackoverflow.com/questions/226279/decoding-a-wbxml-syncml-message-from-an-s60-device

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!