[umbrello] [Bug 363582] It would be nice for XMI file to have stable format.
Ralf Habacker
bugzilla_noreply at kde.org
Tue Jul 17 00:18:03 BST 2018
https://bugs.kde.org/show_bug.cgi?id=363582
--- Comment #12 from Ralf Habacker <ralf.habacker at freenet.de> ---
(In reply to Ralf Habacker from comment #9)
> Currently not. In general I see several options to fix this:
> 2. use a different xml writer
The very rudimentary xml writer as shown below may be used as starting point
class KDomElement {
public:
KDomElement(const QString &name = QString()) : m_tag(name) {}
void setAttribute(const QString &name, const QString &value)
{
m_attributes.append(QString("%1=\"%2\"").arg(name, value));
}
// add more methods
void appendChild(KDomElement &element)
{
m_childs.append(element);
}
QString toString() const
{
if (m_childs.size() > 0) {
QString s = !m_tag.isEmpty() ? QString("<%1 %2>\n").arg(m_tag,
m_attributes.join(" ")) : "";
foreach(const KDomElement &child, m_childs) {
s += child.toString();
}
s += !m_tag.isEmpty() ? QString("</%1>\n").arg(m_tag) : "";
return s;
} else
return !m_tag.isEmpty() ? QString("<%1 %2 />\n").arg(m_tag,
m_attributes.join(" ")) : "";
}
protected:
QString m_tag;
QStringList m_attributes;
QList<KDomElement> m_childs;
};
class KDomDocument : public KDomElement {
public:
KDomDocument(const QString &name=QString())
: KDomElement(name)
{
}
KDomElement createElement(const QString &name)
{
return KDomElement(name);
}
};
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the umbrello-devel
mailing list