The problem is the newline character at the end of the string in the xml.. the new String(...) method seems
to cant handle this.. stringbuffer can.
Maybe this is a new bug.. but i'am not familiar enough with the expected behaviour in this case to claim it as a
bug

I would say just take this solution for now.. or even better.. clean your XMLs

I'm not sure why this is happening. I'm developing my library outside of the Android Framework, but I fully intend to move it inside once I get to a certain stage. So I'm using Java SDK 1.6, and the SAX parse that comes with it.
I've encountered this wierd error. My Java overridden method is:

You checking in both methods for a tag named "COLUMN NAME".
Replace all "COLUMN NAME" to "COLUMN" and it should work.
The tag name is "COLUMN" the "NAME" is a attribute of the tag not part of the tag name.
Due to that your COLUMN boolean is never true and therefore nothing is saved to your parsed
dataset.

I can use this with emulator without any problem.When I'm trying to install this into my phone, I've got this message:

Parse ErrorThere is a problem parsing the package.

I have no idea what's going on, I tried to parse XML with standard DocumentBuilder and I got the same message. Without XML parsing functions everything working fine. Have you got any idea?I'm using 1.5.

The problem is the newline character at the end of the string in the xml.. the new String(...) method seemsto cant handle this.. stringbuffer can.Maybe this is a new bug.. but i'am not familiar enough with the expected behaviour in this case to claim it as abug

I would say just take this solution for now.. or even better.. clean your XMLs

Just to make this a bit more clear. SAX buffers the calls to the characters method. This means that within a single block of character data, the characters(..) method could get called multiple times with only "chunks" of the text. In other words, the character array, from the start value to the full length, will not always be the full block of text you are looking for.

You ALWAYS need to append the character array into a StringBuffer, and handle the StringBuffer on the next end (or start) element event in order to get the full block of text you are looking for.

tolas wrote:You ALWAYS need to append the character array into a StringBuffer, and handle the StringBuffer on the next end (or start) element event in order to get the full block of text you are looking for.

Can you give an example of this. I might be having the same problem. I am trying to parse out an xml file with almost 1000 records [each has 4 properties] and it fails in four of them. it cuts out one of the property strings and gives them as multiple records.

tolas wrote:You ALWAYS need to append the character array into a StringBuffer, and handle the StringBuffer on the next end (or start) element event in order to get the full block of text you are looking for.

Can you give an example of this. I might be having the same problem. I am trying to parse out an xml file with almost 1000 records [each has 4 properties] and it fails in four of them. it cuts out one of the property strings and gives them as multiple records.

This was quickly done from the top of my head without compiling it, but it should be correct.

For example if you want to grab all the character data inside a "blah" element".

NOTE: This is the most basic example. If you have nested elements inside of "blah" this will also pick up those elements character data. If you have nested "blah" elements inside of each other, this most likely will not produce the result you want as it will stop buffering at the end of the inner "blah". But this is a good foundation to start with.

tolas wrote:NOTE: This is the most basic example. If you have nested elements inside of "blah" this will also pick up those elements character data. If you have nested "blah" elements inside of each other, this most likely will not produce the result you want as it will stop buffering at the end of the inner "blah". But this is a good foundation to start with.

Thank you Tolas.

That worked perfect after I did necessary modifications.this is what I have done.

I have not checked the syntax of this java file as I have modified it a little to remove my project specific names. But I hope this will help anyone out there like me. Please let me know if I have done any mistakes or if it can be done in a better way.

Thanks again Tolas for the quick and accurate reply. Precisely what I needed.

tolas wrote:NOTE: This is the most basic example. If you have nested elements inside of "blah" this will also pick up those elements character data. If you have nested "blah" elements inside of each other, this most likely will not produce the result you want as it will stop buffering at the end of the inner "blah". But this is a good foundation to start with.

Thank you Tolas.

That worked perfect after I did necessary modifications.this is what I have done.

I have not checked the syntax of this java file as I have modified it a little to remove my project specific names. But I hope this will help anyone out there like me. Please let me know if I have done any mistakes or if it can be done in a better way.

Thanks again Tolas for the quick and accurate reply. Precisely what I needed.

Note quite right. It happens to be working with your sample XML because the id and name fields are so short there aren't multiple buffered calls to characters(..).

Doing this in your characters(..) method is just the same as setting it to a string there (your not really doing anything by buffering it into StringBuffer.

Hi droid friends..
i read lot of sax parsing threads but still no success because of my xml's encoding..
when i replace ISO-8859-X with UTF-8, works like a charm but cant replace encoding of the the xml because its public.
if i append the xml to a stringbuffer then replace the encoding; parser can parse it but takes ages..
what should i do now ? please help..