I am using the StAX parsing to read the XML.
In my case,the xml contains one attribute as <description>......</description>.
But,if the size of the value for description tag is more(eg: 300 lines and each line having around 8000 characters)the StAX is not able to read the whole value.
for getting the value I am using getText() method of stream reader
It will read only 3-4 lines.My question is:
1)how to read the whole value?
2)what is the max. size StAX will read for an attribute?
I assume that if you call getText() again you will get some more text from that text node. Or perhaps you could call getTextElement() to get the whole text node, or use a version of the code which appears in the API documentation for getTextElement().
You didn't consider doing a simple debugging exercise like reading through the document and outputting the list of events that Stax saw? There's a lot to be said for trying things to see what happens. Usually it's more educational than asking a single question on a forum.
Joined: Mar 13, 2012
Thanks for the comment.
Now ,I am getting the value by using getText() method after every event and concatinating the value.Like
That's good. Just one minor thing: if you're going to be doing a lot of concatenating to build up the big string, you might consider using a StringBuilder to do that. It's more resource-efficient, in terms of the number of temporary String objects you're creating.