Bug 23840 - char[] in the character gets flooded
Summary: char[] in the character gets flooded
Status: NEW
Alias: None
Product: Xerces-J
Classification: Unclassified
Component: SAX (show other bugs)
Version: 1.4.4
Hardware: Sun Linux
: P3 blocker
Target Milestone: ---
Assignee: Xerces-J Developers Mailing List
Depends on:
Reported: 2003-10-15 14:36 UTC by ckamala kannan
Modified: 2004-11-16 19:05 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description ckamala kannan 2003-10-15 14:36:27 UTC
In the DefaultHandler class , i am using the characters() by overriding it .
It is notified when the characters in the xml . But once the array reaches it 
max size 2048 . it recreates the array .ie.., a new array is created . The data 
in the previuos array is overwritten by the new array .


<sometag>want to display the name </sometag>

once the notification for the above is received with the values as follows

character(char ch[] ,int start ,int length )
1.) assume so far the ch[] is stored with 2042 characters .
2.) for this notification , the ch[] will have only the characters "want t" in 
the ch [].
3.) so in the next notification it will have the other part of the char "o 
display the name ". 
4.) so the previous value "want t" is missed .

One solution is to store the previous value "want t" in a temporary string and 
use them in the next notification .

But there is one issue we may not know when to use the previous value .
Because of 

* <sometag>want to display the name </sometag>
+ <sometag>show rollno</sometag>

1.) at * the ch[] may get exactly 2048 characters.
2.) Assume the next notification is at + . 
3.) then we should not use the prev.  value . Since it is esactly at the next 

So please investigate it and response me at ckamalakannan@netscape.net
Comment 1 Joe Kesselman 2003-10-15 15:11:10 UTC
Sounds like normal SAX operation. Text may be broken up into multiple calls to
characters(), and the array is not guaranteed to be retained from call to call
for buffer-management reasons. It's the application's responsibility to copy the
data it wishes to retain into whatever storage representation it considers