Created
March 3, 2014 11:43
-
-
Save amitsaha/9323351 to your computer and use it in GitHub Desktop.
RNG Schema
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import lxml.etree | |
xml = '''<job> | |
<recipeSet> | |
<recipe> | |
<distroRequires> | |
<distro_name op="=" value="BlueShoeLinux5-5"/> | |
</distroRequires> | |
<hostRequires> | |
<system> | |
<last_inventoried op="=" value="2013-10-10" /> | |
</system> | |
<force host="blah"/> | |
</hostRequires> | |
<task name="/distribution/install" role="STANDALONE"/> | |
</recipe> | |
</recipeSet> | |
</job>''' | |
schema = lxml.etree.RelaxNG(lxml.etree.parse('beaker-job.rng')) | |
print schema.validate(lxml.etree.fromstring(xml)) | |
messages = [str(e.message) for e in schema.error_log] | |
print messages |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment