Commit 49f5a388 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge remote-tracking branch 'origin/master' into...

Merge remote-tracking branch 'origin/master' into 1280-eco-annotation-in-search-results-not-hyperlinked
parents 975471db ed549da3
Pipeline #28213 passed with stage
in 14 minutes and 54 seconds
......@@ -21,6 +21,10 @@ minerva (15.0.0~beta.5) unstable; urgency=medium
break upload (#1273)
* Bug fix: export from minerva does not include SemanticZoom terms for text
notes (#1287)
* Bug fix: import from GPML introduces space between inhibition and process
(#1270)
* Bug fix: map cantaining kinetic equations exported to CellDesigner was not
a valid SBML file (#1271)
-- Piotr Gawron <piotr.gawron@uni.lu> Tue, 2 Jun 2020 16:00:00 +0200
......
......@@ -266,17 +266,18 @@ final public class XmlParser {
t.setOutputProperty(OutputKeys.INDENT, "yes");
t.setOutputProperty(OutputKeys.METHOD, "xml");
NodeList list = node.getChildNodes();
for (int i = 0; i < list.getLength(); i++) {
Node element = list.item(i);
t.transform(new DOMSource(element), new StreamResult(sw));
if (includeHeadNode) {
t.transform(new DOMSource(node), new StreamResult(sw));
} else {
NodeList list = node.getChildNodes();
for (int i = 0; i < list.getLength(); i++) {
Node element = list.item(i);
t.transform(new DOMSource(element), new StreamResult(sw));
}
}
} catch (TransformerException te) {
logger.debug("nodeToString Transformer Exception");
}
if (includeHeadNode) {
return "<" + node.getNodeName() + ">" + sw.toString() + "</" + node.getNodeName() + ">";
}
return sw.toString();
}
......
......@@ -99,6 +99,14 @@ public class XmlParserTest extends CommonTestFunctions {
assertTrue(str.contains(xml));
}
@Test
public void testNodeToStringWithHeaderAndAttrib() throws Exception {
String xml = "<test_node x=\"y\">test_x</test_node>";
Node validDoc = XmlParser.getXmlDocumentFromString(xml).getDocumentElement();
String str = XmlParser.nodeToString(validDoc, true);
assertTrue(str.contains(xml));
}
@Test
public void testConcurrencyParse() throws Exception {
StringBuilder builder = new StringBuilder("<doc>");
......
......@@ -80,7 +80,7 @@ public class KineticsXmlParser {
try {
StringBuilder result = new StringBuilder();
result.append("<kineticLaw>");
Node mathNode = XmlParser.getXmlDocumentFromString(kinetics.getDefinition()).getFirstChild();
Node mathNode = XmlParser.getXmlDocumentFromString(kinetics.getDefinition()).getDocumentElement();
for (Node ciNode : XmlParser.getAllNotNecessirellyDirectChild("ci", mathNode)) {
String id = XmlParser.getNodeValue(ciNode).trim();
Element element = model.getElementByElementId(id);
......
......@@ -45,7 +45,7 @@ public class SbmlValidationTests extends CellDesignerTestFunctions {
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" });
result.add(new Object[] { "testFiles/reactions/kinetics.xml" });
return result;
}
......
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