0

I have create an android application where parse data using saxparser .But Problem is that it does not parse the whole string inside the tag. The first 4 or 5 word is shown. Why i do not able to parse the whole string inside the tag. I follow the site....

http://www.androidpeople.com/android-xml-parsing-tutorial-using-saxparser

Please help me . Thank in advance.

dulal_026
  • 589
  • 1
  • 6
  • 20

2 Answers2

1

Use this in the character method of your xml handler

public void characters (char ch[], int start, int length) {
    if (buf!=null) {
        for (int i=start; i<start+length; i++) {
            buf.append(ch[i]);
        }
    }
}

Where buf is a string builder.

blessanm86
  • 31,439
  • 14
  • 68
  • 79
0

The tutorial you followed has a bug in their characters method. The characters method may be called multiple times per tag, so you need to append the characters to your current value rather than starting a new String.

Rob
  • 4,733
  • 3
  • 32
  • 29