Results 1 to 3 of 3

Thread: What about error: C2039 'createElement': no es un miembro de 'QDomComment'

  1. #1
    Join Date
    Jan 2017
    Location
    Vigo
    Posts
    5
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Exclamation What about error: C2039 'createElement': no es un miembro de 'QDomComment'

    Hi everyone!

    I keep trying to implement some piece of code to write in a xml file some tags.

    I see this video tutorial:

    https://www.youtube.com/watch?v=NXGE5XUrRSI

    I'll show you below

    Qt Code:
    1. #include <QtXml>
    2.  
    3. int main(int argc, char *argv[])
    4. {
    5. Q_UNUSED(argc);
    6. Q_UNUSED(argv);
    7.  
    8. // Write XML
    9. QDomComment document;
    10.  
    11. // Make the root element
    12. QDomElement root = document.createElement("Campus");
    13.  
    14. // Add it to the document
    15. document.appendChild(root);
    16.  
    17. // Write to file
    18. QFile file("C:/XML_OUT/gbxml.xml");
    19. if(!file.open(QIODevice::WriteOnly | QIODevice::Text ))
    20. {
    21. qDebug() << "Failed to open file for writting";
    22. return -1;
    23. }
    24. else
    25. {
    26. QTextStream stream(&file);
    27. // stream << document.toString();
    28. file.close();
    29. qDebug() << "Finished";
    30. }
    31.  
    32. return a.exec();
    33. }
    To copy to clipboard, switch view to plain text mode 


    error: C2039: 'createElement': no es un miembro de 'QDomComment'

    error: C2039: 'toString': no es un miembro de 'QDomComment'

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: What about error: C2039 'createElement': no es un miembro de 'QDomComment'

    Line 9 should read:
    Qt Code:
    1. QDomDocument document;
    To copy to clipboard, switch view to plain text mode 
    See the video at 1:50.

  3. The following user says thank you to ChrisW67 for this useful post:

    ivanotero76 (13th January 2017)

  4. #3
    Join Date
    Jan 2017
    Location
    Vigo
    Posts
    5
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: What about error: C2039 'createElement': no es un miembro de 'QDomComment'

    Thank you. It solved

Similar Threads

  1. Replies: 3
    Last Post: 19th November 2014, 19:44
  2. Replies: 4
    Last Post: 29th April 2014, 16:20
  3. error C2039: 'hwnd' : is not a member of QPalette
    By weixj2003ld in forum Qt Programming
    Replies: 2
    Last Post: 19th December 2011, 06:32
  4. : error: [\NokiaQtSDK\Symbian\SDK\epoc32\release\gcce\udeb\V ideo.exe] Error 1
    By ranjit.kadam in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 1st May 2011, 22:11
  5. Replies: 0
    Last Post: 22nd June 2010, 20:27

Tags for this Thread

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.