Skip to content

Instantly share code, notes, and snippets.

@tinogis
Created April 19, 2016 08:52
Show Gist options
  • Save tinogis/801c959e2589abb32c6ff2f1a216d2bf to your computer and use it in GitHub Desktop.
Save tinogis/801c959e2589abb32c6ff2f1a216d2bf to your computer and use it in GitHub Desktop.
Validates a CNMC ATR management XML file with using switching library. Selects the correct XSD file automatically from message header
# -*- encoding: utf-8 -*-
import sys
from switching.input.messages import message
from switching.input.messages.message import except_f1
with open(sys.argv[1], 'r') as xml_file:
try:
data = xml_file.read()
m = message.Message(data)
m.parse_xml()
sys.stdout.write('Fitxer Correcte\n')
except Exception, e:
sys.stdout.write('Fitxer Invàlid: {0}\n'.format(str(e.value)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment