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 '&':
sb.Append("&");
break;
case '<':
sb.Append("&lt;");
break;
case '>':
sb.Append("&gt;");
break;
case '\'':
sb.Append("&#039;");
break;
case '"':
sb.Append("&quot;");
break;
default:
sb.Append(c);
break;
}
}
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;
}



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

-----Original Message-----
From: android-developers@googlegroups.com
[mailto:android-develop...@googlegroups.com] On Behalf Of 3D
Sent: Thursday, January 29, 2009 3:59 PM
To: Android Developers
Subject: [android-developers] Re: SAXParser getting stuck on certain
characters


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

On Jan 28, 9:14am, "Brad Gies" <rbg...@gmail.com> wrote:
them,
you
the


--~--~---------~--~----~------------~-------~--~----~



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:
the
"
dog
"
runs

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. non-map/video overlay?

I would like to use views as overlays on other views, and to specify
the layout using xml. I've tried FrameLayouts, AbsoluteLayouts, and
RelativeLayouts, but I can't seem to get 2 views to overlap.

Actually, using the hierarchy viewer, I was able to see that I had a
FrameLayout behind a view, but when I tried to bring the FrameLayout
to the front it was pushed to beside that view.

I tried a couple of attempts using SurfaceView, but I still have the
same issue of setting up the overlapping layout first. I did not get a
SurfaceView to work yet, and I'd really like to stick with non-
SurfaceViews if possible.

The examples I've found for overlays and surface views all seem to be
for maps and video, but I want to overlay my own custom views.

So, how can you set up normal views to overlap?

TIA,
Craig
--~--~---------~--~----~------------~-------~--~----~

2. Shipping price to Singapore

Hi all.

I was looking around everywhere on the shipping price of the Android
Dev Phone 1 to Singapore. I know that the device cost $399 USD but
thats excluding the shipping cost and shipping cost differ from
country to country.

Would any one happen to be able to check for the shipping price of the
phone to Singapore since I do not want to waste the dev fee of $25
just to move on to find that shipping price would be too expensive and
I change my mind.

Help on the price would be greatly appreciated.

Thanks

InterestedDev

--~--~---------~--~----~------------~-------~--~----~

3. restricting EditText to certain number of characters

4. How to place a call from an application

5. Transparent textures in OpenGL

6. Who know the WMA and WMV playback ?

7. Stack overflow - 32 deep class hierarchy