Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QDomDocument formatting
Forum Updated to NodeBB v4.3 + New Features

QDomDocument formatting

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 2.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Randall
    wrote on last edited by
    #1

    Hello. I am having some problems with creating a QDomDocument. I have the following code:
    @QDomDocument dom;
    QDomElement root = dom.createElement("cmd");
    dom.appendChild(root);
    QDomElement param = dom.createElement("param");
    root.appendChild(param);
    QDomElement id = dom.createElement("id");
    QDomElement value = dom.createElement("value");
    param.appendChild(id);
    param.appendChild(value);
    QDomText idTxt = dom.createTextNode("FOO");
    id.appendChild(idTxt);
    QDomText valueTxt = dom.createTextNode("BAR");
    value.appendChild(valueTxt);@
    It creates the following output:
    @<cmd>
    <param>
    <id>FOO</id>
    <value>BAR</value>
    </param>
    </cmd>
    @
    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.
    @<cmd>
    <param><id>FOO</id><value>BAR</value></param>
    </cmd>
    @

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • G Offline
        G Offline
        goetz
        wrote on last edited by
        #3

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

        http://www.catb.org/~esr/faqs/smart-questions.html

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved