Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

# -*- coding: UTF-8 -*- 

# Copyright 2013-2014 Luc Saffre 

# License: BSD (see file COPYING for details) 

 

 

USAGE = """ 

Validate an XML file against the XSD for a SEPA payment order. 

 

Usage:: 

 

  python -m lino.utils.xmlgen.sepa.validate XMLFILE 

 

Arguments: 

 

XMLFILE : the name of the xml file to validate, or '-' to read from stdin 

""" 

 

import sys 

from os.path import join, dirname 

from lxml import etree 

 

if __name__ == '__main__': 

 

    if len(sys.argv) < 2: 

        print USAGE 

        sys.exit(-1) 

 

    xmlfile = sys.argv[1] 

    doc = etree.parse(file(xmlfile)) 

 

    xsdfile = join(dirname(__file__), 'XSD', 'pain.001.001.02.xsd') 

    xsd = etree.XMLSchema(etree.parse(file(xsdfile))) 

 

    xsd.assertValid(doc)