java - XMLStreamReader Problem -


i'm using xmlstreamreader interface javax.xml parse xml file. file contains huge data amounts , single text nodes of several kb.

the validating , reading works good, i'm having trouble text nodes larger 15k characters. problem occurs in function

string foo = ""; if (xsr.geteventtype() == xmlstreamconstants.characters) {     foo = xsr.gettext();     xsr.next(); // read next tag } return foo; 

xsr being stream reader. text in text node 53'337 characters long in particular case (but varies), xsr.gettext() method returns first 15'537 of them. of course loop on function , concatenate strings, somehow don't think that's idea...

i did not find in documentation or anywhere else this. intended behavior or can confirm/deny it? using wrong way somehow?

thanks

of course loop on function , concatenate strings, somehow don't think that's idea...

actually, is idea :)

the parser permitted break event stream wishes, long it's consistent original document. means can, , will, break text data multiple events. how , when chooses implementation detail internal parser, , unpredictable.

so yes, if receive multiple sequential characters events, need append them manually. price pay low-level api.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -