Commit 5c6c0aba authored by Piotr Gawron's avatar Piotr Gawron

escape xml when writing reaction name

parent 9a1a42e0
Pipeline #26529 passed with stage
in 12 minutes and 45 seconds
minerva (14.0.12) stable; urgency=medium
* Bug fix: comments on submaps were not visible (#1230)
* Bug fix: removing comment from submap did not work
* Bug fix: reaction name containing "<" character was exported inproperly to
CellDesigner (#1227)
-- Piotr Gawron <piotr.gawron@uni.lu> Mon, 11 May 2020 17:00:00 +0200
......
......@@ -103,7 +103,7 @@ public class ReactionToXml {
sb.append("metaid=\"" + reaction.getIdReaction() + "\" ");
sb.append("id=\"" + reaction.getIdReaction() + "\" ");
if (reaction.getName() != null && !reaction.getName().isEmpty()) {
sb.append("name=\"" + reaction.getName() + "\" ");
sb.append("name=\"" + XmlParser.escapeXml(reaction.getName()) + "\" ");
}
sb.append("reversible=\"" + reaction.isReversible() + "\" ");
sb.append(">\n");
......
......@@ -44,6 +44,8 @@ public class SbmlValidationTests extends CellDesignerTestFunctions {
result.add(new Object[] { "testFiles/parameter.xml" });
result.add(new Object[] { "testFiles/model_with_annotations.xml" });
result.add(new Object[] { "testFiles/reactions/modifier_with_operator.xml" });
result.add(new Object[] { "testFiles/problematic/problematic_reaction_name.xml" });
return result;
}
......
<?xml version="1.0" encoding="UTF-8"?>
<sbml xmlns="http://www.sbml.org/sbml/level2/version4" xmlns:celldesigner="http://www.sbml.org/2001/ns/celldesigner" level="2" version="4">
<model metaid="untitled" id="untitled">
<annotation>
<celldesigner:extension>
<celldesigner:modelVersion>4.0</celldesigner:modelVersion>
<celldesigner:modelDisplay sizeX="600" sizeY="400"/>
<celldesigner:listOfCompartmentAliases/>
<celldesigner:listOfComplexSpeciesAliases/>
<celldesigner:listOfSpeciesAliases>
<celldesigner:speciesAlias id="sa1" species="s1">
<celldesigner:activity>inactive</celldesigner:activity>
<celldesigner:bounds x="119.0" y="176.0" w="80.0" h="40.0"/>
<celldesigner:font size="12"/>
<celldesigner:view state="usual"/>
<celldesigner:usualView>
<celldesigner:innerPosition x="0.0" y="0.0"/>
<celldesigner:boxSize width="80.0" height="40.0"/>
<celldesigner:singleLine width="1.0"/>
<celldesigner:paint color="ffccffcc" scheme="Color"/>
</celldesigner:usualView>
<celldesigner:briefView>
<celldesigner:innerPosition x="0.0" y="0.0"/>
<celldesigner:boxSize width="80.0" height="60.0"/>
<celldesigner:singleLine width="0.0"/>
<celldesigner:paint color="3fff0000" scheme="Color"/>
</celldesigner:briefView>
<celldesigner:info state="empty" angle="-1.5707963267948966"/>
</celldesigner:speciesAlias>
<celldesigner:speciesAlias id="sa2" species="s2">
<celldesigner:activity>inactive</celldesigner:activity>
<celldesigner:bounds x="417.0" y="153.0" w="80.0" h="40.0"/>
<celldesigner:font size="12"/>
<celldesigner:view state="usual"/>
<celldesigner:usualView>
<celldesigner:innerPosition x="0.0" y="0.0"/>
<celldesigner:boxSize width="80.0" height="40.0"/>
<celldesigner:singleLine width="1.0"/>
<celldesigner:paint color="ffccffcc" scheme="Color"/>
</celldesigner:usualView>
<celldesigner:briefView>
<celldesigner:innerPosition x="0.0" y="0.0"/>
<celldesigner:boxSize width="80.0" height="60.0"/>
<celldesigner:singleLine width="0.0"/>
<celldesigner:paint color="3fff0000" scheme="Color"/>
</celldesigner:briefView>
<celldesigner:info state="empty" angle="-1.5707963267948966"/>
</celldesigner:speciesAlias>
</celldesigner:listOfSpeciesAliases>
<celldesigner:listOfGroups/>
<celldesigner:listOfProteins>
<celldesigner:protein id="pr1" name="s1" type="GENERIC"/>
<celldesigner:protein id="pr2" name="s2" type="GENERIC"/>
</celldesigner:listOfProteins>
<celldesigner:listOfGenes/>
<celldesigner:listOfRNAs/>
<celldesigner:listOfAntisenseRNAs/>
<celldesigner:listOfLayers/>
<celldesigner:listOfBlockDiagrams/>
</celldesigner:extension>
</annotation>
<listOfUnitDefinitions>
<unitDefinition metaid="substance" id="substance" name="substance">
<listOfUnits>
<unit metaid="CDMT00003" kind="mole"/>
</listOfUnits>
</unitDefinition>
<unitDefinition metaid="volume" id="volume" name="volume">
<listOfUnits>
<unit metaid="CDMT00004" kind="litre"/>
</listOfUnits>
</unitDefinition>
<unitDefinition metaid="area" id="area" name="area">
<listOfUnits>
<unit metaid="CDMT00005" kind="metre" exponent="2"/>
</listOfUnits>
</unitDefinition>
<unitDefinition metaid="length" id="length" name="length">
<listOfUnits>
<unit metaid="CDMT00006" kind="metre"/>
</listOfUnits>
</unitDefinition>
<unitDefinition metaid="time" id="time" name="time">
<listOfUnits>
<unit metaid="CDMT00007" kind="second"/>
</listOfUnits>
</unitDefinition>
</listOfUnitDefinitions>
<listOfCompartments>
<compartment metaid="default" id="default" size="1" units="volume"/>
</listOfCompartments>
<listOfSpecies>
<species metaid="s1" id="s1" name="s1" compartment="default" initialAmount="0">
<annotation>
<celldesigner:extension>
<celldesigner:positionToCompartment>inside</celldesigner:positionToCompartment>
<celldesigner:speciesIdentity>
<celldesigner:class>PROTEIN</celldesigner:class>
<celldesigner:proteinReference>pr1</celldesigner:proteinReference>
</celldesigner:speciesIdentity>
</celldesigner:extension>
</annotation>
</species>
<species metaid="s2" id="s2" name="s2" compartment="default" initialAmount="0">
<annotation>
<celldesigner:extension>
<celldesigner:positionToCompartment>inside</celldesigner:positionToCompartment>
<celldesigner:speciesIdentity>
<celldesigner:class>PROTEIN</celldesigner:class>
<celldesigner:proteinReference>pr2</celldesigner:proteinReference>
</celldesigner:speciesIdentity>
</celldesigner:extension>
</annotation>
</species>
</listOfSpecies>
<listOfReactions>
<reaction metaid="re1" id="re1" name="s1 &lt; s2" reversible="false">
<annotation>
<celldesigner:extension>
<celldesigner:name>s1 &lt; s2</celldesigner:name>
<celldesigner:reactionType>STATE_TRANSITION</celldesigner:reactionType>
<celldesigner:baseReactants>
<celldesigner:baseReactant species="s1" alias="sa1">
<celldesigner:linkAnchor position="INACTIVE"/>
</celldesigner:baseReactant>
</celldesigner:baseReactants>
<celldesigner:baseProducts>
<celldesigner:baseProduct species="s2" alias="sa2">
<celldesigner:linkAnchor position="INACTIVE"/>
</celldesigner:baseProduct>
</celldesigner:baseProducts>
<celldesigner:connectScheme connectPolicy="direct" rectangleIndex="0">
<celldesigner:listOfLineDirection>
<celldesigner:lineDirection index="0" value="unknown"/>
</celldesigner:listOfLineDirection>
</celldesigner:connectScheme>
<celldesigner:line width="1.0" color="ff000000"/>
</celldesigner:extension>
</annotation>
<listOfReactants>
<speciesReference metaid="CDMT00001" species="s1">
<annotation>
<celldesigner:extension>
<celldesigner:alias>sa1</celldesigner:alias>
</celldesigner:extension>
</annotation>
</speciesReference>
</listOfReactants>
<listOfProducts>
<speciesReference metaid="CDMT00002" species="s2">
<annotation>
<celldesigner:extension>
<celldesigner:alias>sa2</celldesigner:alias>
</celldesigner:extension>
</annotation>
</speciesReference>
</listOfProducts>
</reaction>
</listOfReactions>
</model>
</sbml>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment