Skip to content

Nodes of NewXML do not inherit namespaces from parent document #92

@jonrkarr

Description

@jonrkarr

Example document:

<sedML xmlns="http://sed-ml.org/sed-ml/level1/version3" level="1" version="3"
  xmlns:sbml="http://www.sbml.org/sbml/level2/version3">
  <listOfModels>
    <model id="model_1" source="model.xml">
      <listOfChanges>
        <addXML target="/sbml:sbml/sbml:model/sbml:listOfParameters" >
          <newXML >
            <sbml:parameter id="V_mT" value="0.7" />
          </newXML >
        </addXML >
      </listOfChanges>
    </model>
  </listOfModels>  
</sedML>

The snippet below illustrates the issue. The SED-ML elements inherit the namespaces of the parent document, but the nodes of NewXML do not. This means that namespaces involved in the content of NewXML needs to be defined for each node in NewXML, which is tedious.

import libsedml
doc = libsedml.readSedMLFromFile('example.sedml')

doc.getListOfModels()[0].getListOfChanges()[0].getNamespaces().getNumNamespaces()
[1]: 2

doc.getListOfModels()[0].getListOfChanges()[0].getNewXML().getNamespaces().getNumNamespaces()
[2]: 0

Similarly, namespaces for NewXML can't be defined at the level of NewXML. For example, the following isn't supported either.

<newXML xmlns:sbml="http://www.sbml.org/sbml/level2/version3">
  <sbml:parameter id="V_mT" value="0.7" />
</newXML >

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions