Well. the best thing to do would be to escape those characters at the
server that sends the document, but if that is not possible then you could
download the document into a Stream, escape them there, or even remove them,
and then pass it to the SAX parser. Later, if you display the contents, you
would have to unescape the contents before you display it.
Sincerely,
Brad Gies
-----------------------------------------------------------------
Brad Gies
27415 Greenfield Rd, # 2,
Southfield, MI, USA
48076
www.bgies.com www.truckerphone.com
www.EDI-Easy.com www.pricebunny.com
-----------------------------------------------------------------
Moderation in everything, including abstinence
_____
From: android-developers@googlegroups.com
[mailto:android-develop...@googlegroups.com] On Behalf Of Tim Bray
Sent: Tuesday, January 27, 2009 3:21 PM
To: android-developers@googlegroups.com
Subject: [android-developers] Re: SAXParser getting stuck on certain
characters
On Tue, Jan 27, 2009 at 12:10 PM, 3D <ernestgfre...@gmail.com> wrote:
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?
XML is very fussy about character encoding. If your supposedly XML doc has
malformed characters (for example, if some UTF-8 got dropped into what you
think was ASCII, or ISO-8859 into UTF-8), well, it's not XML, sorry, and the
software won't let you do that. This is controversial (many people have
historically thought it's OK to ignore internationalization problems) but
it's the way it is, you're stuck with it.
There are other parsers like TagSoup and one in xmllib2 that will let you
bypass breakage and go on working, but they're pretty big chunks of code.
-Tim
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---