Skip to content

ISO20022/django-validate-xsd

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Validate XSD - XML Schema

Example for the usage of PyXB and Django.

If you are new to the subject of XSD, WADL and XML, I suggest reading the blog: Thomas Nurkiewic, 2012

"In principle WADL is similar to WSDL, but the structure of the language is much different. Whilst WSDL defines a flat list of messages and operations either consuming or producing some of them, WADL emphasizes the hierarchical nature of RESTful web services. In REST, the primary artifact is the resource. Each resource (noun) is represented as an URI. Every resource can define both CRUD operations (verbs, implemented as HTTP methods) and nested resources. The nested resource has a strong relationship with a parent resource, typically representing an ownership."

XSD to WADL

We use PyXB to generate a generic "wadl.py" file for the XML Schema validation of related XML file "wadl.xml" documents via django.

Basis for the validation is the XML Schema described in "wadl.xsd". It functions as our basis for the generated "wadl.py" file. And then "po.xml" files can be entered and checked in our webservice admin interface.

Install

Run

  • python manage.py check
  • python manage.py migrate
  • python manage.py makemigrations
  • python manage.py runserver 0:8000

You can regenerate a alternative "wadl.py" fiel within the "webservicedocs" directory with the following command:

  • pyxbgen -u wadl.xsd -m wadl

Now test it with a valid XML file "wadl.xml" and start changing tags, etc.

You find xsd/xml examples in the pyxb repository

Have fun!

Remarks: The source code follows initialy ideas set out in a blog by Robert Newman (now offline)

Copyright (C) 2015 Peter Rosemann

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%