1
我想驗證一些xml數據對在線模式。使用xmllint驗證xml針對遠程文件
$ xmllint --schema https://raw.githubusercontent.com/IATI/IATI-Schemas/version-2.01/iati-activities-schema.xsd --noout iati-data/*.xml
返回:
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
然而,XSD確實存在:
curl https://raw.githubusercontent.com/IATI/IATI-Schemas/version-2.01/iati-activities-schema.xsd
返回
<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...
不知道我做錯了...
感謝這一點,下載主XSD以及兩個相關文件,然後運行本地工作的xmllint。 – user2761030