Error org. xmlpull. v1.XmlPullParserException, xmlpull
Zookeeper
Error:
Org. xmlpull. v1.XmlPullParserException: Unexpected token (position: TEXT margin @ injava. io. StringReader @ 41822568)
It is always possible to parse others' xml, but I cannot Parse them. I think it must be because my format is incorrect, but my format is also correct, the encoding format of the file is incorrect. My server defaults to gb2312.
My client uses UTF-8 to achieve consistency.
I tried it today and changed the server code, but it still didn't work. After searching the entire network, I used to borrow the code of a brother.
XmlPullParser. setInput (new StringReader (str) is incorrect no matter how it is called.
Last changed
InputStream is = new ByteArrayInputStream (response. data); xmlPullParser. setInput (is, "UTF-8 ");
In this way, everything is okay. Please use volley to parse xml.
Zookeeper
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.