Menu

[WBXML] Reference Toolkit not encoding <Type>

Help
2004-09-30
2013-04-08
  • Gerald Smith

    Gerald Smith - 2004-09-30

    I have a problem with the RTK encoding a server alerted sync message into WBXML.

    The message is encoded correctly except this part:
    alertItem.meta = smlString2Pcdata("<Type xmlns=\&quot;syncml:metinf\&quot;>text/x-vcard</Type>");

    The Type Tag should be encoded with a Codepage switch (0x00 0x01) followed by the string "text/x-vcard'. But instead the RTK includes the _whole_ type tag as plain text.

    The RTK WBXML Message gets rejected by the phone.

    I also tried to use the Wbxml Library (http://libwbxml.aymerick.com) for converting the RTK-generated XML message into WBXML. This succeeds: the message is accepted by the phone with a Success-Response Code and a
    reply follows.

    Do i need to specify this
    alertItem.meta = smlString2Pcdata("<Type xmlns=\&quot;syncml:metinf\&quot;>text/x-vcard</Type>");
    in another way?

    Regards,
    Gerald

     
    • Darryl Champagne

      Yes, it must be specified differently.  One example is in the manual, from manual/H_SCENARIO_DEVICE_INFO_EXAMPLE_OVER.html, which I accessed from manual\SMLIND03.HTM):

          /* the meta element contains a sub DTD, so set the contentType and
           * extension fields appropriately
           */
          _put->itemList->item->meta = smlLibMalloc(sizeof(SmlPcdata_t));
          _put->itemList->item->meta->contentType = SML_PCDATA_EXTENSION;
          _put->itemList->item->meta->extension   = SML_EXT_METINF;
          _put->itemList->item->meta->length      = 0;
          _put->itemList->item->meta->content     =
      smlLibMalloc(sizeof(SmlMetInfMetInf_t));
          _meta = _put->itemList->item->meta->content;
          smlLibMemset(_meta, 0, sizeof(SmlMetInfMetInf_t));
          _meta->type = buildPcdata("application/vnd.syncml-devinf+xml");

      That is why that code fails - smlString2Pcdata is not namespace aware - it isn't much more than a strcpy.  You have to set the extension field (and contentType) to switch codepages.

      An important development criteria for the RTK was minimal code space, for use on extremely limited devices (and this was several years ago - much more limited than todays devices).  Thus the RTK does as little parsing as possible.

      dgc

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.