diff --git a/list.py b/list.py new file mode 100644 index 0000000..787e20a --- /dev/null +++ b/list.py @@ -0,0 +1,25 @@ +#! usr/bin/env python +import optparse, libxml2, sys + +def validate(xml_file, dtd_file): + doc = libxml2.parseFile(xml_file) + dtd = libxml2.parseDTD(None, dtd_file) + ctxt = libxml2.newValidCtxt() + ret = doc.validateDtd(ctxt, dtd) + dtd.freeDtd() + doc.freeDoc() + return ret + + +def main(): + op = optparse.OptionParser(description = U"check", prog = "dtd", version = "0.1", usage = U"%prog") + op.add_option("-x", "--xml", dest = "xml", help = U"XML Doc", metavar = "XML_FILE") + op.add_option("-d", "--dtd", dest = "dtd", help = U"DTD Doc", metavar = "DTD_FILE") + options, arguments = op.parse_args() + if options.xml and options.dtd: + validate(options.xml, options.dtd) + else: + op.print_help() + +if __name__ == "__main__": + main() diff --git a/mephi.dtd b/mephi.dtd new file mode 100644 index 0000000..cd65218 --- /dev/null +++ b/mephi.dtd @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/mephi.xml b/mephi.xml new file mode 100644 index 0000000..b75bc67 --- /dev/null +++ b/mephi.xml @@ -0,0 +1,20 @@ + + + + + + + Molochkov + Ivanov + Petrov + + + Titorenko + Sidorov + Ryabov + + + + + +