blob: a4a6c00ddd858d0161d16c494d7089b9096177af (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
# $Id$
import os
def relaxng(xml, rng):
"""
Validate a chunk of xml against a RelaxNG schema.
"""
i, o = os.popen4(("xmllint", "--noout", "--relaxng", rng, "-"))
i.write(xml)
i.close()
v = o.read()
o.close()
if v != "- validates\n":
raise RuntimeError, "RelaxNG validation failure:\n" + v
|