From 3446c335201cd65bffadf3d99d95c3b0066baf68 Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Tue, 21 Sep 2010 15:52:27 +0000 Subject: [PATCH] fixed an error in the reading of the XML file. Comments in the node of a file would create error conditions. Now, you can add comments anywhere and there shouldn't be any runtime differences. --- Cantera/src/thermo/SpeciesThermoFactory.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Cantera/src/thermo/SpeciesThermoFactory.cpp b/Cantera/src/thermo/SpeciesThermoFactory.cpp index d8e901afc..100a77b29 100644 --- a/Cantera/src/thermo/SpeciesThermoFactory.cpp +++ b/Cantera/src/thermo/SpeciesThermoFactory.cpp @@ -816,7 +816,17 @@ namespace Cantera { speciesNode["name"], ""); } const XML_Node& thermo = speciesNode.child("thermo"); - const std::vector& tp = thermo.children(); + + // Get the children of the thermo XML node. In the next bit of code we take out the comments that + // may have been childrent of the thermo XML node by doing a selective copy. + // These shouldn't interfere with the algorithm at any point. + const std::vector& tpWC = thermo.children(); + std::vector tp; + for (int i = 0; i < static_cast(tpWC.size()); i++) { + if (! (tpWC[i])->isComment()) { + tp.push_back(tpWC[i]); + } + } int nc = static_cast(tp.size()); string mname = thermo["model"]; @@ -845,9 +855,6 @@ namespace Cantera { else if (f->name() == "NASA9") { installNasa9ThermoFromXML(speciesNode["name"], spthermo, k, tp); } - // else if (f->name() == "HKFT") { - // installHKFTThermoFromXML(s["name"], spthermo, k, tp); - //} #ifdef WITH_ADSORBATE else if (f->name() == "adsorbate") { installAdsorbateThermoFromXML(speciesNode["name"], spthermo, k, *f);