Skip to content

Commit a04b373

Browse files
csnardijhy
authored andcommitted
Use the XML parser if the MIME-type matches an XML type
1 parent 2736346 commit a04b373

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/main/java/org/jsoup/helper/HttpConnection.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,9 @@ static Response execute(Connection.Request req, Response previousResponse) throw
547547
throw new UnsupportedMimeTypeException("Unhandled content type. Must be text/*, application/xml, or application/xhtml+xml",
548548
contentType, req.url().toString());
549549

550+
if (contentType.startsWith("application/xml") || xmlContentTypeRxp.matcher(contentType).matches())
551+
req.parser(Parser.xmlParser());
552+
550553
res.charset = DataUtil.getCharsetFromContentType(res.contentType); // may be null, readInputStream deals with it
551554
if (conn.getContentLength() != 0) { // -1 means unknown, chunked. sun throws an IO exception on 500 response with no content when trying to read body
552555
InputStream bodyStream = null;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy