Giter VIP home page Giter VIP logo

xml-schema-downloader's Introduction

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

xml-schema-downloader's People

Contributors

n-a-t-e avatar marcinfair avatar kad-dirc avatar ryge avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.