Results 1 to 12 of 12

Thread: QDomImplementation real dom Document;

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QDomImplementation real dom Document;

    i wand to write xml doc on QDomDocument not entyti ....

    on line to line the doc is so:
    Qt Code:
    1. xml.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
    2. xml.append("<cms:root xmlns:cms=\"http://www.pulitzer.ch/2005/PuliCMS/1.0\">");
    3. xml.append("<cms:page la=\"it\">");
    4. xml.append(desc_it->GetXMLTag());
    5. xml.append("</cms:page>");
    6. xml.append("</cms:root>");
    7. QString stayutf8 = xml.join("\n");
    8. qDebug() << "### xml result1 " << stayutf8;
    To copy to clipboard, switch view to plain text mode 

    and on a real QDomDocument.... Manual say so:

    Qt Code:
    1. QDomDocument doc(QDomImplementation::createDocument(QString("http://www.pulitzer.ch/2005/PuliCMS/1.0/"),
    2. QString("utf8"),(const QDomDocumentType)"xml"));
    3. QDomElement root = doc.createElement("root");
    4. root.setAttribute("xmlns:s","http://www.pulitzer.ch/2005/shop/shema/1.0/");
    5. root.setAttribute("xmlns:cms","http://www.pulitzer.ch/2005/PuliCMS/1.0/");
    6. doc.appendChild(root);
    7. QDomElement page = doc.createElement("cms:page");
    8. page.setAttribute("xmlns:cms","http://www.pulitzer.ch/2005/PuliCMS/1.0/");
    9. page.setAttribute("la","it");
    10. page.appendChild((const QDomDocumentFragment)(desc_it->GetXMLTag()));
    11. root.appendChild(page);
    12. QString xml = doc.toString();
    13. qDebug() << "### xml result2 " << xml;
    To copy to clipboard, switch view to plain text mode 

    on php5 and qt all dom function is same but new domdocument no....

    php = $dom = new DOMDocument('1.0', 'utf-8') and become a clean first line...

    qt no why?

    how to become a clean line <?xml version=\"1.0\" encoding=\"utf-8\"?> so tidy xml dont clean?
    Last edited by jacek; 23rd June 2006 at 14:33. Reason: code changed, so it doesn't break the page layout

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.