I am trying to validate some xml data against an online schema.
$ xmllint --schema https://raw.githubusercontent.com/IATI/IATI-Schemas/version-2.01/iati-activities-schema.xsd --noout iati-data/*.xml
Returns:
warning: failed to load external entity "https://raw.githubusercontent.com/IATI/IATI-Schemas/version-2.01/iati-activities-schema.xsd"
Schemas parser error : Failed to locate the main schema resource at 'https://raw.githubusercontent.com/IATI/IATI-Schemas/version-2.01/iati-activities-schema.xsd'.
WXS schema https://raw.githubusercontent.com/IATI/IATI-Schemas/version-2.01/iati-activities-schema.xsd failed to compile
However, the xsd does exist:
curl https://raw.githubusercontent.com/IATI/IATI-Schemas/version-2.01/iati-activities-schema.xsd
Returns
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="2.01">
<xsd:annotation>
<xsd:documentation xml:lang="en">
International Aid Transparency Initiative: Activity-Information Schema
Release 2.01, 2014-10-21
etc...
Not sure what I am doing wrong...
Unfortunately that XSD is written to using relative paths for the supporting XSDs. There is even a note to that effect in the comments:
NOTE: the xml.xsd and iati-common.xsd schemas must be in the same directory as this one.
If you cannot change the XSDs to reference the full, absolute URL to the included and imported XSDs, a work-around would be to download the main XSD along with its dependents and access the local main XSD instead. Another work-around would be to use an XML Catalog to remap the location of the dependent XSDs in absolute URL terms.