java - Parsing ContentFragment using VTDXML for UTF-16 encoded xml -


i using vtd-xml v2.11 , trying contents of tag using getcontentfragment. when xml has utf-8 encoding code works fine. utf-16 encoding offset , len conversion failing.

while ((i = ap.evalxpath()) != -1) {         long l = vn.getcontentfragment();         if (l != -1) {             int len = (int) (l >> 32);             int offset = (int) l;             sb.append(vn.tostring(offset, len));         }     } 

this works utf-8 xmls, utf-16 throws arrayindexoutofbound , when call tostring(offset,len) method. please understand how handle length , offset utf-16 encoded xml strings.

thanks in advance...

i think might have been fixed in 2.13.1 version of vtd-xml. can download , give try?


Comments