utf 8 - Android open UTF-8 XML -


hello xml file on utf-8 follow sample , code this

string text = "";    string str; bufferedreader in = new bufferedreader(new inputstreamreader(new fileinputstream(path), "utf-8")); while ((str = in.readline()) != null) {     text += str; } return text; 

and try parse code dom parser

document doc = parser.getdomelement(result); 

and fail have check xml file hexeditor have following charcode before "<": ef bb bf

what have miss? why getdomelement tell me unexpected token (position:text @1:2)

text += str + "\n"; 

if there line break in tag:

<img src="smile.jpg"/> 

you get:

<imgsrc="smile.jpg"> 

and other cases.

stringbuilder text = new stringbuilder();    try (bufferedreader in = new bufferedreader(new inputstreamreader(         new fileinputstream(path), "utf-8"))) {     string str;     while ((str = in.readline()) != null) {         text.append(str).append("\n");     } } // in.close() return text.tostring(); 

Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -