Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xmllint doesn't work with https - warning: failed to load external entity

Tags:

xmllint

xmllint does work fine with http://somesite.xml

But it doesn't work with https://somesite.xml

xmllint https://somesite.xml
warning: failed to load external entity "https://somesite.xml"
like image 845
whitesiroi Avatar asked Jul 27 '16 02:07

whitesiroi


1 Answers

As a workaround, you could use another utility like curl or wget to download the file first, then pipe it to xmllint.

curl --silent "https://somesite.xml" | xmllint -

Notes:

  • Use - ("hyphen/minus") for xmllint's filename argument to get its XML input from the standard input stream instead of from a file or URL.
  • You might want to use --silent (-s) to suppress curl progress/error messages, to prevent those from being parsed by xmllint.
  • Quotes might be required around the URL if it contains special characters.

This should work for xmllint's XML input over HTTPS, but not sure about a DTD or schema; you might need to download that to a local file first, using a separate curl or wget command.

like image 59
Chris Tollefson Avatar answered Nov 06 '22 21:11

Chris Tollefson