SAXParser getting stuck on certain characters

by 3D » Mon, 26 Jan 2009 15:18:22 GMT

Sponsored Links
 I'm using a SAXParser to parse an XML document and its getting stuck
on certain symbols like the 'trademark' symbol and I think even double-
quotes ".  I really don't need these characters so it would be fine if
the parser just skips over these.  Instead it throws an exception and
quits parsing the document.  What can I do?

SAXParser getting stuck on certain characters

by 3D » Wed, 28 Jan 2009 04:10:43 GMT

 Help please.


Sponsored Links

SAXParser getting stuck on certain characters

by 3D » Fri, 30 Jan 2009 04:59:18 GMT

 Thank you both for your responses!  I think I will try just removing
these characters.


SAXParser getting stuck on certain characters

by Brad Gies » Fri, 30 Jan 2009 12:01:14 GMT

 ust in case you want to escape/unescape them (it's a little better), here
is what I use (they are C#, but easy to convert to Java). They are simple. I
found the original on the web, but don't remember the author to give the
credit to :

public String EscapeXML(String str)
StringBuilder sb = new StringBuilder();
foreach (Char c in str)
switch (c)
case '&':
case '<':
case '>':
case '\'':
case '"':
return sb.ToString();

This one could be made faster, but it's simple :).

public String Unescape(String str)
str = str.Replace("&amp;", "&");
str = str.Replace("&lt;", "<");
str = str.Replace("&gt;", ">");
str = str.Replace("&#039;", "\\");
str = str.Replace("&#39;", "'");
str = str.Replace("&quot;", "\"");
str = str.Replace("&lt;", "<");
return str;


Brad Gies

Brad Gies
27415 Greenfield Rd, # 2,
Southfield, MI, USA

Moderation in everything, including abstinence

-----Original Message-----
[] On Behalf Of 3D
Sent: Thursday, January 29, 2009 3:59 PM
To: Android Developers
Subject: [android-developers] Re: SAXParser getting stuck on certain

Thank you both for your responses! I think I will try just removing
these characters.

On Jan 28, 9:14am, "Brad Gies" <> wrote:


SAXParser getting stuck on certain characters

by Scott G » Sat, 07 Mar 2009 10:54:23 GMT


What I found out was that when the parser hit one of those characters
between element tags, the characters function would be called again.
so a value like

<tag>the "dog" runs</tag>
would render 5 calls:

my solution was to intialize a temporary string on the startelement
call, append that string in the characters call, then assign it to the
proper variable end the end element call.


Other Threads

1. user mode build and dexpreopt

In building the image with the user variant, dexpreopt failed with
following error.

30:37.267647  dexpreopt: WaitForString: "#", 20.0
30:57.287851  dexpreopt: Timeout expired after 20.0 seconds
30:57.287922  dexpreopt: Killing emulator

It seems emulator is not working. Please suggest me some pointer to
resolve this.


2. Status bar extension causes splash screen

Hello, everybody.
I have a problem on the omap3evm which the android version is Rowboat
Android 1.6. When I extend the status bar, the screen splashes!! However, if
I stop moving the status bar extension, the screen does not splashes. Does
anyone have the same problem??

I have a suggestion. I think that the priority of both background activity
and status bar extension activity is the same, so that the splash screen
occurs. The two activities preempt the display. I am not sure if I am right
or not, would anyone understand and inform me please .. I will appreciate
for your help!



3. Motorola Droid + Roo

4. Can't upload my .apk to the market - minSdkVersion error every time.

5. Atas Nama LogayPektay Tolong Mod Tolong.

6. progress?

7. Is there a way to view app memory usage in Nexus One while in authoring mode?