encoding - ' ', hexadecimal value 0x1F, is an invalid character. Line 1, position 1 -
encoding - ' ', hexadecimal value 0x1F, is an invalid character. Line 1, position 1 -
i trying read xml file web , parse out using xdocument. works fine gives me error day:
**' ', hexadecimal value 0x1f, invalid character. line 1, position 1**
i have tried solutions google aren't working vs 2010 express windows phone 7.
there solution replace 0x1f character string.empty code homecoming stream doesn't have replace method.
s = s.replace(convert.tostring((byte)0x1f), string.empty);
here code:
void webclient_openreadcompleted(object sender, openreadcompletedeventargs e) { using (var reader = new streamreader(e.result)) { int[] counter = { 1 }; string s = reader.readtoend(); stream str = e.result; // s = s.replace(convert.tostring((byte)0x1f), string.empty); // byte[] str = convert.frombase64string(s); // stream memstream = new memorystream(str); str.position = 0; xdocument xdoc = xdocument.load(str); var info = query in xdoc.descendants("user") select new mobion { index = counter[0]++, avlink = (string)query.element("user_info").element("avlink"), nickname = (string)query.element("user_info").element("nickname"), track = (string)query.element("track"), artist = (string)query.element("artist"), }; listbox.itemssource = data; } }
xml file: http://music.mobion.vn/api/v1/music/userstop?devid=
consider using system.web.httputility.htmldecode if you're decoding content read web.
encoding linq-to-xml windows-phone
Comments
Post a Comment