-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Dobrý den,
When trying to validate the provided CCMM sample XML file against the CCMM schema using xmllint:
xmllint --noout --schema dataset/schema.xsd ccmm_sample.xml
Ends with this errors:
error : Unknown IO error
warning: failed to load external entity "http://www.w3.org/XML/1998/namespace"
language-system/schema.xsd:3: element import: Schemas parser warning : Element '{http://www.w3.org/2001/XMLSchema}import': Failed to locate a schema at location 'http://www.w3.org/XML/1998/namespace'. Skipping the import.
...
The issue is that XSD files import the XML namespace like this:
<xs:import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="http://www.w3.org/XML/1998/namespace"/>SchemaLocation assumes that there is link to XSD file. The correct schema file ('schemaLocitain' atribut) is http://www.w3.org/2001/xml.xsd.
How to solve this issue manually
Replace all occurrences of
schemaLocation="http://www.w3.org/XML/1998/namespace"with
schemaLocation="http://www.w3.org/2001/xml.xsd"This can be replaced manually with sed command with:
grep -rl --include='*.xsd' 'schemaLocation="http://www.w3.org/XML/1998/namespace"' . \
| xargs sed -i.bak \
's|schemaLocation="http://www.w3.org/XML/1998/namespace"|schemaLocation="http://www.w3.org/2001/xml.xsd"|g'After this fix, the validation is succeessful:
xmllint --noout --schema dataset/schema.xsd ccmm_sample.xml
ccmm_sample.xml validatesI would like to add some instructions to the README or Wiki, how we can validate our own schema using the xmllint tool.
_I hope this hasn’t already been solved or discussed somewhere else, I can't find it.
Metadata
Metadata
Assignees
Labels
No labels