L
leo
I have created a sax parser to parse elements from a XML file into a
database. I thought everything worked smooth, but while testing I
found that sometimes element values were incorrectly parsed. Sometimes
just the last part of the value is parsed (e.g. "00" instead of
"2620200000000") I can't specify when exactly it happens, but it
always happens at the same place in the same XML file.
Using the debugger I found what happens, however I don't know a proper
way to solve it.
This is the element:
<IMSI>262020000000000</IMSI>
The method 'public void characters(char ch[], int start, int length)'
assigns the element value to an element. The char array ch has a
length of 2048 chars. When parsing the value "262020000000000" in this
case it uses 2 passes, because it appearantly didn't fit in the buffer
completely.
In the first step start=2035 and length = 13; this delivers
"26202000000"
At the second step the buffer has been refreshed, length = 2, start =
0. This returns "00". Resulting in the final value"00" for IMSI which
is not correct. Do I have to work around this with adding strings or
is anything else I can do here?
kind regards,
leo
database. I thought everything worked smooth, but while testing I
found that sometimes element values were incorrectly parsed. Sometimes
just the last part of the value is parsed (e.g. "00" instead of
"2620200000000") I can't specify when exactly it happens, but it
always happens at the same place in the same XML file.
Using the debugger I found what happens, however I don't know a proper
way to solve it.
This is the element:
<IMSI>262020000000000</IMSI>
The method 'public void characters(char ch[], int start, int length)'
assigns the element value to an element. The char array ch has a
length of 2048 chars. When parsing the value "262020000000000" in this
case it uses 2 passes, because it appearantly didn't fit in the buffer
completely.
In the first step start=2035 and length = 13; this delivers
"26202000000"
At the second step the buffer has been refreshed, length = 2, start =
0. This returns "00". Resulting in the final value"00" for IMSI which
is not correct. Do I have to work around this with adding strings or
is anything else I can do here?
kind regards,
leo