diff -r 93b982ccede2 -r 5daf16870df6 qmake/generators/xmloutput.cpp --- a/qmake/generators/xmloutput.cpp Mon Jun 21 22:38:13 2010 +0100 +++ b/qmake/generators/xmloutput.cpp Thu Jul 22 16:41:55 2010 +0100 @@ -81,6 +81,11 @@ currentState = state; } +void XmlOutput::setFormat(XMLFormat newFormat) +{ + format = newFormat; +} + XmlOutput::XMLState XmlOutput::state() { return currentState; @@ -172,6 +177,20 @@ case tTag: newTagOpen(o.xo_text); break; + case tTagValue: + addRaw(QString("\n%1<%2>").arg(currentIndent).arg(o.xo_text)); + addRaw(QString("%1").arg(o.xo_value)); + addRaw(QString("").arg(o.xo_text)); + break; + case tValueTag: + addRaw(QString("%1").arg(doConversion(o.xo_text))); + setFormat(NoNewLine); + closeTag(); + setFormat(NewLine); + break; + case tImport: + addRaw(QString("\n%1").arg(currentIndent).arg(o.xo_text).arg(o.xo_value)); + break; case tCloseTag: if (o.xo_value.count()) closeAll(); @@ -183,6 +202,9 @@ case tAttribute: addAttribute(o.xo_text, o.xo_value); break; + case tAttributeTag: + addAttributeTag(o.xo_text, o.xo_value); + break; case tData: { // Special case to be able to close tag in normal @@ -266,7 +288,7 @@ tagStack.pop_back(); break; case Attribute: - xmlFile << "/>"; + xmlFile << " />"; tagStack.pop_back(); currentState = Tag; decreaseIndent(); // <--- Post-decrease indent @@ -307,7 +329,7 @@ qDebug("<%s>: Cannot add declaration when not in bare state", tagStack.last().toLatin1().constData()); return; } - QString outData = QString("") + QString outData = QString("") .arg(doConversion(version)) .arg(doConversion(encoding)); addRaw(outData); @@ -337,4 +359,20 @@ xmlFile << currentIndent << doConversion(attribute) << "=\"" << doConversion(value) << "\""; } +void XmlOutput::addAttributeTag(const QString &attribute, const QString &value) +{ + switch(currentState) { + case Bare: + case Tag: + //warn_msg(WarnLogic, "<%s>: Cannot add attribute since tags not open", tagStack.last().toLatin1().constData()); + qDebug("<%s>: Cannot add attribute (%s) since tag's not open", + (tagStack.count() ? tagStack.last().toLatin1().constData() : "Root"), + attribute.toLatin1().constData()); + return; + case Attribute: + break; + } + xmlFile << " " << doConversion(attribute) << "=\"" << doConversion(value) << "\""; +} + QT_END_NAMESPACE