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. DOMImplementationRegistry::getDOMImplementation on QtXML
QtWS25 Last Chance

DOMImplementationRegistry::getDOMImplementation on QtXML

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

    Is there a direct mapping from the below implementation using Xerces on QtXML? Or for getting the DOM Implementation object I always need a QDomDocument instance?

    @
    DOMImplementation impl = DOMImplementationRegistry::getDOMImplementation(XMLString::transcode((const char)"Range"));
    @

    thanks in advance!

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

      There is only on DOM implementation instance, that's Qt's. So there is no need to have a registry here.

      What do you want to do with that object?

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

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jabtcha
        wrote on last edited by
        #3

        Actually all I need is that my XML file has to have:

        @<?xml version="1.0" encoding="UTF-8" standalone="no" ?>@

        on the first line, even before:

        @<!DOCTYPE System PUBLIC "-//blabla/bla" "b.dtd">@

        for instance. I'm using QDomDocument::save() and the document never has what I need as a the first line so I thought that I was missing to get this implementation object from this "magical" registry that we don't have on QtXML. I'm clearly wrong about that, but how can I have this first line that I need now?

        Thanks in advance

        1 Reply Last reply
        0
        • D Offline
          D Offline
          DenisKormalev
          wrote on last edited by
          #4

          As I've said in another thread about xml declaration you simply can get text representation of your xml, concat with declaration and save manually to file.

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

            This works for me:

            @
            QDomDocument doc("System PUBLIC "-//blabla/bla" "b.dtd"");
            QDomProcessingInstruction pi = doc.createProcessingInstruction("xml", "version="1.0" encoding="UTF-8" standalone="no" ");
            doc.appendChild(pi);

            QDomElement root = doc.createElement("System");
            doc.appendChild(root);

            QDomElement tag = doc.createElement("Greeting");
            root.appendChild(tag);

            QDomText t = doc.createTextNode("Hello World");
            tag.appendChild(t);

            QString xml = doc.toString();
            @

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

            1 Reply Last reply
            0
            • D Offline
              D Offline
              DenisKormalev
              wrote on last edited by
              #6

              Volker, there is one problem in your code. XML declaration looks like processing instruction, but is not a processing instruction. Declaration can be only at the beginning of the file and instruction can be anywhere in file. So in your order of commands all will work ok, but only in this order (so your second command should always be second).

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

                This works in very place:

                @
                QDomProcessingInstruction pi = doc.createProcessingInstruction("xml", "version="1.0" encoding="UTF-8" standalone="no" ");
                doc.insertBefore(pi, QDomNode());
                @

                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