From: curt Date: Wed, 6 Jun 2001 14:57:58 +0000 (+0000) Subject: - fixed XML syntax error with missing '"' for some attribute values X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4d914db1db57f0e3fef064f878c5767003da68c9;p=simgear.git - fixed XML syntax error with missing '"' for some attribute values that was preventing fgfs save/restore from working - ensured that aliases always appear standalone --- diff --git a/simgear/misc/props_io.cxx b/simgear/misc/props_io.cxx index d7be4950..f2c9992a 100644 --- a/simgear/misc/props_io.cxx +++ b/simgear/misc/props_io.cxx @@ -342,24 +342,26 @@ writeNode (ostream &output, const SGPropertyNode * node, int indent) // write it first. if (node->hasValue()) { doIndent(output, indent); - output << '<' << name << " n=\"" << index; - if (node->isAlias() && node->getAliasTarget() != 0) { - output << "\" alias=\"" - << node->getAliasTarget()->getPath() << "\"/>" << endl; - } else { + output << '<' << name << " n=\"" << index << '"'; + if (node->isAlias() && node->getAliasTarget() != 0) + output << " alias=\"" << node->getAliasTarget()->getPath() << "\"/>"; + else { if (node->getType() != SGValue::UNKNOWN) - output << "\" type=\"" << getTypeName(node->getType()) << '"'; + output << " type=\"" << getTypeName(node->getType()) << '"'; output << '>'; writeData(output, node->getStringValue()); - output << "' << endl;; + output << "' << endl; } } // If there are children, write them // next. - if (nChildren > 0) { + if (nChildren > 0 || node->isAlias()) { doIndent(output, indent); - output << '<' << name << " n=\"" << index << "\">" << endl;; + output << '<' << name << " n=\"" << index << '"'; + if (node->isAlias() && node->getAliasTarget() != 0) + output << " alias=\"" << node->getAliasTarget()->getPath() << '"'; + output << '>' << endl; for (int i = 0; i < nChildren; i++) writeNode(output, node->getChild(i), indent + INDENT_STEP); doIndent(output, indent); @@ -369,10 +371,10 @@ writeNode (ostream &output, const SGPropertyNode * node, int indent) // If there were no children and no // value, at least note the presence // of the node. - if (nChildren == 0 && !node->hasValue()) { - doIndent(output, indent); - output << '<' << name << " n=\"" << index << "\"/>" << endl; - } +// if (nChildren == 0 && !node->isAlias() && !node->hasValue()) { +// doIndent(output, indent); +// output << '<' << name << " n=\"" << index << "\"/>" << endl; +// } return true; }