Quantcast
Viewing latest article 8
Browse Latest Browse All 8

Fatal Error :1:1: Content is not allowed in prolog

I'm using Java and i'm trying to get XML document from some http link. Code I'm using is:

URL url = new URL(link);HttpURLConnection connection = (HttpURLConnection)url.openConnection();connection.setRequestMethod("GET");connection.connect();Document doc = null;CountInputStream in = new CountInputStream(url.openStream());doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(in);

Don't pay attention at CountInputStream, it's some special class acting like regular input stream.

Using the code above, I sometimes got error Fatal Error :1:1: Content is not allowed in prolog. I assume that is has something to do with bad format of xml, but I have no idea how to fix it.


Viewing latest article 8
Browse Latest Browse All 8

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>