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. Regarding QDomDocument
Qt 6.11 is out! See what's new in the release blog

Regarding QDomDocument

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 2.3k 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.
  • I Offline
    I Offline
    Indrajeet
    wrote on last edited by
    #1

    Hi

    I was using QDomDocument to create the XML file.
    By default it will add below line at the start of XML file which I dont want is there any way to remove this?

    <!DOCTYPE xml ()>

    1 Reply Last reply
    0
    • K Offline
      K Offline
      KA51O
      wrote on last edited by
      #2

      Why on earth would you want to remove this already minimal xml header ?

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

        @
        QDomDocument doc("QDNTest");
        QDomProcessingInstruction xmlVers = doc.createProcessingInstruction("xml", "version="1.0" ");
        doc.appendChild(xmlVers);
        QDomElement root = doc.createElement("QDNTest");
        doc.appendChild(root);
        qDebug() << doc.toString();
        @

        This creates output

        @
        <?xml version="1.0" ?>
        <!DOCTYPE QDNTest>
        <QDNTest/>
        @

        To strip the DOCTYPE from the XML, construct the document without argument:

        @
        QDomDocument doc;
        QDomProcessingInstruction xmlVers = doc.createProcessingInstruction("xml", "version="1.0" ");
        doc.appendChild(xmlVers);
        QDomElement root = doc.createElement("QDNTest");
        doc.appendChild(root);
        qDebug() << doc.toString();
        @

        This creates output

        @
        <?xml version="1.0" ?>
        <QDNTest/>
        @

        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