Error while parsing XML file with StAx Error while parsing XML file with StAx xml xml

Error while parsing XML file with StAx


Strictly because an answer is easier to read than the reading through the comments....

Answer from Dimitri


I may find the answer to my question. The problem was when I have received the answer from the server as InputStream, I parse it. As you may know, in Java, once an InputStream is parsed, it is close automatically. Things sometime we forgot. Thanks for the documentation.

The answer is very simple. In my program, before I called the method I parse, I use to display the content input Stream to see what I am receiving. The fact is, once you read/parse your inpustream, it is automatically close. See the link below. So when I call my method parse, the Inputstream parameter was already close, this is why I caught this error.