Important: Please read the Qt Code of Conduct -

QDomDocument formatting

  • Hello. I am having some problems with creating a QDomDocument. I have the following code:
    @QDomDocument dom;
    QDomElement root = dom.createElement("cmd");
    QDomElement param = dom.createElement("param");
    QDomElement id = dom.createElement("id");
    QDomElement value = dom.createElement("value");
    QDomText idTxt = dom.createTextNode("FOO");
    QDomText valueTxt = dom.createTextNode("BAR");
    It creates the following output:
    The issue I'm having, is that I"m not able to output a particular DOM element and it's associated children on the same line of the XML. Formatting like this is something that I think would be trivial, but I can't seem to make it happen and I don't see any examples demonstrating such an output. Does anybody know if this is possible using the QDom classes? I'm sure I can brute force it by manually generating the XML, but I would of course prefer to do it with the DOM classes. Any help would be greatly appreciated.

  • I don't think that formatting at this level is supported.

  • No, it is not supported to be output the way you suggested.

Log in to reply