Why am I getting this error Premature end of file?

后端 未结 7 2052
滥情空心
滥情空心 2020-12-16 10:40

I am trying to parse an XML response, but I am failing miserably. I thought initially that the xml was just not being returned in the response, so

7条回答
  •  一个人的身影
    2020-12-16 11:14

    When you do this,

    while((inputLine = buff_read.readLine())!= null){
            System.out.println(inputLine);
        }
    

    You consume everything in instream, so instream is empty. Now when try to do this,

    Document doc = builder.parse(instream);
    

    The parsing will fail, because you have passed it an empty stream.

提交回复
热议问题