• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Parsing WBXML POSt Request Data

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
I want to read WBXML formatted SyncML data sent by a Mobile Device
There is a servlets at server side which receives the http request of the
device and tries to read the contents of the POST request data by using .
Request.getInputStream(); method....
I then Pass this data to a method "wbxmlToXml(req.getInputStream().toString().getBytes()) "
I am using kxml as XML parsing the Initial Lines of the method are as following
"
public static String wbxmlToXml(byte[] wbxml) throws IOException {
String xml = null;
try {
// Construct an InputStream on byte[] to be used by WbxmlParser
ByteArrayInputStream in = new ByteArrayInputStream(wbxml);
AbstractXmlParser parser; //org.kxml.parser.AbstractXmlParser
parser = new WbxmlParser(in);
// Construct a DOM Document to parse WBXML
Document document = new Document();
document.parse(parser);------------------> Error :java.io.IOException: id 54 undef.
....
.....
"
I get "java.io.IOException: id 54 undef." error as mentioned above.

Please somebody guide regarding this problem or som,e other way to parse the WBXML format from Streamed Post Data

Regards,
Maneesha
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Why are you trying to convert to byte[]? XML is always unicode characters - changing back and forth runs the risk of a bad character conversion creating an illegal character.

I don't know about the library you are using but the standard Java library parser is happy with an InputStream created from a String.

Bill
 
reply
    Bookmark Topic Watch Topic
  • New Topic