java - How to get entire xml as string from stream using SAX parser? -


i know can convert inputstream string using :

 public static string convertstreamtostring(servletinputstream is) {     java.util.scanner s = new java.util.scanner(is).usedelimiter("\\a");     return s.hasnext() ? s.next() : ""; } 

which fine, input stream xml parse using sax parser, , wondering if there faster way xml string, since parser loops through stream.

i can work concating string in events,but wondering if there's faster/built in way so, since code performance-sensitive

if have use sax, there doesn't seem built-in way, see echoing xml file sax parser. or consider using stax if can.


Comments