biosimulations/biosimulations-physiome

Deal with cases when SED-ML is saved with extension `.xml`

bilalshaikh42 opened this issue · 2 comments

You could read all files with extension .xml and check whether the default namespace starts with the URIs for CellML.

import lxml.etree
etree = lxml.etree.parse(filename)
root = etree.getroot()
default_ns = root.nsmap.get(None, '')
is_cellml = default_ns.startswith('http://www.cellml.org/cellml/')
is_sedml = default_ns.startswith('http://sed-ml.org/sed-ml/')

Rather than fixing this here, PMR2/models.physiomeproject.org#23 encourages the Physiome team to handle this upstream.