XML von Seite auslesen Jsoup

Ich möchte dies Auslesen:
Document doc = Jsoup.connect("https://www.openligadb.de/api/getmatchdata/bl1/2017").get();
Bekomme aber diese Fehlermeldung:
Code:
Exception in thread "main" java.net.SocketTimeoutException: Read timed out
    at java.base/java.net.SocketInputStream.socketRead0(Native Method)
    at java.base/java.net.SocketInputStream.socketRead(Unknown Source)
    at java.base/java.net.SocketInputStream.read(Unknown Source)
    at java.base/java.net.SocketInputStream.read(Unknown Source)
    at java.base/sun.security.ssl.SSLSocketInputRecord.read(Unknown Source)
    at java.base/sun.security.ssl.SSLSocketInputRecord.bytesInCompletePacket(Unknown Source)
    at java.base/sun.security.ssl.SSLSocketImpl.bytesInCompletePacket(Unknown Source)
    at java.base/sun.security.ssl.AppInputStream.read(Unknown Source)
    at java.base/java.io.BufferedInputStream.fill(Unknown Source)
    at java.base/java.io.BufferedInputStream.read1(Unknown Source)
    at java.base/java.io.BufferedInputStream.read(Unknown Source)
    at java.base/sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
    at java.base/sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
    at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
    at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at java.base/java.net.HttpURLConnection.getResponseCode(Unknown Source)
    at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source)
    at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:734)
    at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:705)
    at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:295)
    at org.jsoup.helper.HttpConnection.get(HttpConnection.java:284)
    at fussball.importer.main(importer.java:12)
Wie kann ich zurückgegebene xml Files Auslesen
 
K

kneitzel

Dein Problem ist ein Timeout beim Lesen auf dem Socket.

Ohne Details kann man Dir nicht weiterhelfen....

Und XML in Java auswerten / bearbeiten: Mal online das Java ist auch eine Insel Buch angesehen? Das ganze Kapitel 18 dreht sich um XML.
 
Eventuell funktioniert's mit timeout(0):
Java:
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
public class JsoupTest {
  public static void main(String[] args) throws IOException {
    Document document = Jsoup.connect("https://www.openligadb.de/api/getmatchdata/bl1/2017")
        .header("Accept", "application/xml")
        .timeout(0)
        .get();
  }
}
(ohne Accept HTTP header kommt JSON zurück)
 
Passende Stellenanzeigen aus deiner Region:

Neue Themen

Oben