Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xmllint validation of VSM #23

Open
tsodring opened this issue Jun 8, 2021 · 0 comments
Open

xmllint validation of VSM #23

tsodring opened this issue Jun 8, 2021 · 0 comments

Comments

@tsodring
Copy link
Collaborator

tsodring commented Jun 8, 2021

xmllint ignores the hint specified in schemaLocation about which XSD files to use when validating. Nor does it seem possible to tell xmllint to use multiple xsd files. The following StackOverflow Q&A shows an approach that works. When applied to the VSM output in export-all, the following approach can be used to validate. Create a xsd file called vsm-include.xsd with the following content:

<?xml version="1.0" encoding="UTF-8"?>
<schema elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema">
    <import namespace="http://www.arkivverket.no/standarder/noark5/arkivstruktur" schemaLocation="arkivstruktur.xsd"/>
    <import namespace="http://localhost:8092/noark5v5//schemas/vnd-email-v1.xsd" schemaLocation="vnd-email-v1.xsd"/>
</schema>

Then to validate use the following command:

xmllint --noout --schema vsm-include.xsd arkivstruktur.xml

I checked this by making a change to the vsm:

vnd-email-v1:thread<[email protected]></vnd-email-v1:thread>

to

vnd-email-v1:thread1<[email protected]></vnd-email-v1:thread1>

and got the following result

arkivstruktur.xml:124: element thread1: Schemas validity error : Element '{http://localhost:8092/noark5v5//schemas/vnd-email-v1.xsd}thread1': This element is not expected. Expected is one of ( {http://localhost:8092/noark5v5//schemas/vnd-email-v1.xsd}thread, {http://localhost:8092/noark5v5//schemas/vnd-email-v1.xsd}message-id ).
arkivstruktur.xml fails to validate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant