0

my requirement is to parse xml data from the server side and display it in Blackberry, I am using SAX parser to perform this operation. I am using an example to explain the scenario.

<Name>ABC</Name> <Company>TCS</Company> <Name>DEF</Name> <Company>E&Y</Company>

In the above example, it is possible to read all the attribute except the "E&Y".

varunrao321
  • 925
  • 2
  • 10
  • 18

3 Answers3

1

Your xml is corrupted. Check for xml escaping.

Proper xml should look like:

<Company>E&amp;Y</Company>

Fix your xml and the parser becomes to work OK.

Vit Khudenko
  • 28,288
  • 10
  • 63
  • 91
  • thanks for your reply..that was just a sample XML I posted there not the actual one..It is working fine for other XML Data from the server..Only the data with & symbol in it is not displayed on the BB client side .. – varunrao321 Aug 05 '11 at 11:34
  • 1
    Sorry to say this, but then you are going to get not the actual answers.. Post the exact xml you get from the server on which your parser fails. Can you confirm it is properly escaped? – Vit Khudenko Aug 05 '11 at 13:41
  • @Arihmed: thanks for your reply, I have figured out, yes you where correct..the xml reply I am getting from the server is this E&Y.. so I replaced the & with & that solved my issue. – varunrao321 Aug 20 '11 at 04:56
0

Check this thread Blackberry UTF-8 Problem

One ansewr says:

Most likely your xml is in UTF-8 while you have response.getBytes(). String.getBytes() returns bytes for default OS encoding which is ISO-8859-1 on BB. So try to get UTF-8 bytes by calling response.getBytes("UTF-8").

Hope that helps

Community
  • 1
  • 1
Juanma Baiutti
  • 637
  • 1
  • 10
  • 27
-1

I guess the problem is the encoding

Search for "encoding='UTF-8' sax parser"

Juanma Baiutti
  • 637
  • 1
  • 10
  • 27