Proposed fixes to support "multiple code pages" for WBXML documents
Christian Kurzke <[email protected]> Fri, 14 May 2004 14:39:20 -0700
| Newsgroups | gmane.comp.java.enhydra.kxml |
|---|---|
| Message-ID | <[email protected]> |
Hello,
We would like to point out a couple improvements we made when using the
kxml2 parser for WBXML documents.
We used the source code from the current CVS repository as a basis for
our testing. We noticed that the documentation of the current version of
WbxmlParser states it does only support 'code page 0' for WBXML documents.
In the source code on the other hand, the code was almost completely
implemented for multi page support.
For our particular use-case (OMA provisioning documents) we need
multiple pages, so - we completed the implementation and fixed one
additional bug.
Following you find a more detailed description of our changes, and a
diff against the current version.
We would like to contribute those changes to be integrated with the
"official" code.
Please review the proposed changes and let us know if you will integrate
them, or if you want to give us "commit" permissions to perform the
check-ins.
1. Resolve bug in org.kxml2.wap.WbxmlParser.java
Description: in the function parseWapExtension() in case
Wbxml.OPAQUE the "break" statement is missing
(before "default:").
2. To make it working properly we should add
"org.kxml2.wap.WbxmlParser, org.kxml2.wap.WbxmlSerializer"
to the file
src/META-INF/services/org.xmlpull.v1.XmlPullParserFactory.
3. To support multi tables for the methods
setAttrValueTable(),setAttrStartTable(),setTagTable()
we propose to do two changes:
a) In the function nextImpl() replace call peekId() with
readByte().
Originally:
while(id == Wbxml.SWITCH_PAGE){
nextId = -2;
selectPage(readByte(), true);
id = peekId();
}
Our new version:
while(id == Wbxml.SWITCH_PAGE){
nextId = -2;
selectPage(readByte(), true);
id = readByte ();
}
b) In the function readAttr() we added following "while{}"
statement.
Originally:
......................
while (id != 1) {
String name = resolveId(attrStartTable, id);
StringBuffer value;
...............................
Our new version:
.....................
while (id != 1) {
while(id == Wbxml.SWITCH_PAGE){
selectPage(readByte(), false);
id = readByte();
}
String name = resolveId(attrStartTable, id);
StringBuffer value;
.........................
here is what we got as a result of 'cvs diff' command:
diff -r1.16 WbxmlParser.java
637d636
< nextId = -2;
639c638
< id = peekId();
---
> id = readByte();
747a747
> break;
758a759,763
>
> while(id == Wbxml.SWITCH_PAGE){
> selectPage(readByte(), false);
> id = readByte();
> }
Please find attached WbxmlParser.java with all new futures that we
mentioned before.
Please let us know your opinion.
Best regards,
Christian Kurzke,
Victor Havin,
David Santoro,
Jain Sanjay.