[jats-list] validating NLM using python, any tips?

Subject: [jats-list] validating NLM using python, any tips?
From: Ian Mulvany <i.mulvany@xxxxxxxxxxxxxxxxx>
Date: Thu, 28 Nov 2013 16:55:11 +0000
Hi All,

I'm building a small script in python to generate NLM XML. I would
like a companion script
to validate, preferably also in python.

The generating script is a work in progress, but you can review it here:
https://github.com/elifesciences/elife-poa-xml-generation/blob/working/generate-poa-xml.py

My initial attempt to get the NLM DTD for validation failed, the script here:
https://github.com/elifesciences/elife-poa-xml-generation/blob/working/validate.py

returned
Traceback (most recent call last):
  File "validate.py", line 9, in <module>
    dtd = etree.DTD(StringIO(NLM_DTD))
  File "dtd.pxi", line 287, in lxml.etree.DTD.__init__
(src/lxml/lxml.etree.c:150450)
  File "dtd.pxi", line 394, in lxml.etree._parseDtdFromFilelike
(src/lxml/lxml.etree.c:152160)

Has anyone done this in python, if so do you have code you could share?

If I can't get it to work in python, should I consider an alternative
route, what would you suggest?

I'm developing on a mac using OSX Mavericks, but I could also build on
a linux box.


- Ian

---
Head of Technology - eLife
Submit now - http://submit.elifesciences.org/
twitter: @IanMulvany

Current Thread