Skip to content

Recursive XSD downloader- download all files needed for validation

Notifications You must be signed in to change notification settings

cioos-siooc/XML-Schema-Downloader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

XML Schema Downloader

GitHub Super-Linter Python package License: AGPL v3

Use this Python script to recursively download an XML schema (XSD) and all linked schemas. This lets you quickly validate an xml record using a tool such as xmllint.

It supports relative XSD schemaLocations, eg <import schemaLocation="../../../../abc.

Installation

If needed, install virtualenv. Install repo in a new Python 3 environment:

pip install venv --user
python -m venv venv
source venv/bin/activate
pip install .

Running

Run the script with your favorite .xsd URL:

python -m xsd_download https://schemas.isotc211.org/19115/-3/mdb/2.0/mdb.xsd

Your schema ends up in a folder called 'xsd'

Schema validation with xmllint

Then if you have xmllint installed, you can validate an XML file called myrecord.xml by running:

xmllint --noout --schema ./xsd/schemas.isotc211.org/19115/-3/mdb/2.0/mdb.xsd myrecord.xml

Run tests

python tests/tests.py

Docker

You can create a Docker image containing the script. This way you don't need to setup any python and venv.

Build image

docker build -t cioos-siooc/xml-schema-downloader:1.0 .

Run image

Run the image with your favorite .xsd URL:

docker run --rm -v `pwd`:`pwd` -w `pwd` cioos-siooc/xml-schema-downloader:1.0 https://schemas.isotc211.org/19115/-3/mdb/2.0/mdb.xsd

About

Recursive XSD downloader- download all files needed for validation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published