Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validate each NXDL file before using it #17

Open
prjemian opened this issue Oct 12, 2016 · 0 comments
Open

validate each NXDL file before using it #17

prjemian opened this issue Oct 12, 2016 · 0 comments

Comments

@prjemian
Copy link
Contributor

Qualify each NXDL file by validating it against the NXDL Schema (nxdl.xsd) before it is used. This will ensure the NXDL is proper (and has no errors introduced).

Here is some python code that does this:

def validate_xml(xml_file_name):
    '''
    validate an NXDL XML file against an XML Schema file
    :param str xml_file_name: name of XML file
    '''
    xml_tree = lxml.etree.parse(xml_file_name)
    xsd = cache.get_XML_Schema()
return xsd.assertValid(xml_tree)

Use the libxml2 library to perform this validation step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant