WBXML 1.3协议摘要

协议地址:WAP195

 

网络字节顺序:big-endian。

 

为什么要加0x40?

参考:Compressing XML

  • When an element contains content (text nodes or child elements) but no attributes, you add a numeric value of 0x40to the byte code
  • When the element contains one or more attributes but no content, add 0x80to the element byte code
  • When the element contains both an attribute and content, add 0xC0 to the element bye code.

 

封装数据

Opaque Data

opaque = OPAQUE length *byte

其中,QPAQUE一个字节表示,内容是0xc3. length根据内容的字节长度确定,不包含标示位和长度位。

长度算法

length  = data.getBytes().length.

length into 7bit bytes .Assume bytes.length = N

bytes[0] += 0x80;

bytes[1] += 0x80;

……

bytes[n-1] += 0x80;

posted @ 2013-08-28 16:20  Javawer  阅读(594)  评论(0编辑  收藏  举报
作者:Roger Wei
出处:http://www.cnblogs.com/javawer/
转载须保留此声明,并注明在文章起始位置给出原文链接。