title: Java Parsing xml document from url
body: <p>When parsing an URL, I got this error:</p>
  
  <pre><code>[Fatal Error] :1:1: Content is not allowed in prolog
  </code></pre>
  
  <p>What should be improved in the code?
  There is also required link.</p>
  
  <pre><code>    import org.w3c.dom.Document;
      import org.xml.sax.SAXException;
      import javax.xml.parsers.DocumentBuilder;
      import javax.xml.parsers.DocumentBuilderFactory;
      import javax.xml.parsers.ParserConfigurationException;
      import java.io.IOException;
      import java.net.MalformedURLException;
      import java.net.URL;
  
      public class Main2 {
      public static void main(String[] args) throws ParserConfigurationException, MalformedURLException {
          String link = "https://samples.openweathermap.org/data/2.5/weather?q=London&amp;appid=b6907d289e10d714a6e88b30761fae22";
          URL url = new URL(link);
          DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
          DocumentBuilder builder;
          Document doc;
          try {
              builder = factory.newDocumentBuilder();
              doc =  builder.parse(url.openStream());
          } catch (ParserConfigurationException | SAXException | IOException ex) {
              ex.printStackTrace();
          }
      }
  }
  </code></pre>