I'm trying to extract data for the hotel names at the given latitude and longitude in JAVA. I'm getting the following error: [Fatal Error] :1:1: Content is not allowed in prolog. Here is the code and the URL from where I am trying to extract my information. Any suggestion about the issue?
URL url = new URL("https://api.eancdn.com/ean-services/rs/hotel/v3/list?apiKey=vkndmgahz5aekd65pxg4rvvp&locale=en_US¤cyCode=USD&latitude=51.514&longitude=-0.269"");
InputStream is = url.openStream();
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(is);
NodeList itemList =
doc.getElementsByTagName("HotelSummary");
Node itemNode;
Element itemElt;
for(int k=0; k < itemList.getLength(); k++)
{
itemNode = itemList.item(k);
if(itemNode.getNodeType() == Node.ELEMENT_NODE) {
itemElt = (Element) itemNode;
System.out.println("Hotel name: "+itemElt.getElementsByTagName("name").item(0).getTextContent());