Well, you didn't show us that code, but the part you do show doesn't append successive characters to the value, it only takes a value from a single call. You also will have trouble with multi-character code points.
My advice is still valid. You should not assume everything comes in all at once in a single call to 'characters()'. If you want other code to influence our analysis, you can't expect us to read your mind. You have to post it. I recommend you read and follow the advice in http:/sscce.org/ Certainly you have no basis for affront if we fail to account for information that you've withheld. You don't even show us what the declaration of 'tempVal' is! Follow the advice I already gave you: Don't assume that everything you need comes in a single call to 'characters()'. -- Lew On Tuesday, March 6, 2012 1:52:26 PM UTC-8, RedBullet wrote: > > I am talking about what I see when endELement event occurs. I end up with > tempVal containing a partial element. > > Is there some example I can see that does a proper job? Virtually every > example I have seen seems to be making the same assumption I am... > > On Tuesday, March 6, 2012 4:20:10 PM UTC-5, Lew wrote: >> >> SAX parsers, such as you appear to be using, do not guarantee to give all >> the character data for a given element in a single callback to >> 'characters()'. Your logic that assumes otherwise is fatally flawed. >> >> You're not guaranteed to have processed the whole element until >> 'endElement()', of course. >> >> On Tuesday, March 6, 2012 1:09:57 PM UTC-8, RedBullet wrote: >>> >>> I have been debugging this for a while now, and I can only reproduce it >>> when I run in the Android environment (emulator or device), but >>> not reproducible in plain old java. >>> >>> The behavior is that I am just PART of a fragment instead of the entire >>> element. For example >>> >>> .... >>> <Longitude>-71.41000482232</Longitude> >>> >>> What I actually get is just "1000482232". >>> >>> My characters function is the basic: >>> public void characters(char[] ch, int start, int length) throws >>> SAXException { >>> tempVal = new String(ch,start,length); >>> } >>> >>> No errors or exceptions or warning or anything... >>> >>> It is as if it is doing buffering since it appear to give me fragments >>> after parsing some 2-4k lines of XML. >>> >>> Any ideas?? >>> >> -- 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