Results 1 to 10 of 10

Thread: QDomElement's text() for <element> </element> giving me a empty Qstring

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    Apr 2012
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QDomElement's text() for <element> </element> giving me a empty Qstring

    Quote Originally Posted by norobro View Post
    From the docs (link):
    Edit: I'm lacking a bit of sleep on this so what I said previously in this post is kinda off.

    Maybe I'm not getting the full picture with how to use that class to read whitespace, so could you explain it a bit more?

    Right now, my QDomDocument is set as private in my header and predefined. This is the code I use to load the data for retrieving my data.

    Qt Code:
    1. void ScfEncoder::load(QString path)
    2. {
    3. QFile structFile(path);
    4.  
    5. if(!structFile.open(QIODevice::ReadOnly | QIODevice::Text))
    6. {
    7. fatalExit("Failed to open input file!");
    8. }
    9.  
    10. /* Load all data */
    11. xmlData.setContent(structFile.readAll());
    12.  
    13. structFile.close();
    14.  
    15. // Get root
    16. root = xmlData.documentElement();
    17.  
    18. if(root.isNull())
    19. {
    20. fatalExit("Root of the input XML file was not detected!");
    21. }
    22. }
    To copy to clipboard, switch view to plain text mode 

    I'm just asking if there is any way to retrieve whitespace from a node such as the one I provided above using any existing methods or classes in Qt or do I have to kinda do it manually, if it's even possible?
    Last edited by CirqueForge; 22nd April 2012 at 07:37.

Similar Threads

  1. Get element in Qgridlayout
    By dieter in forum Newbie
    Replies: 1
    Last Post: 12th February 2012, 10:51
  2. how to access ith element of an qstring list?
    By aurora in forum Qt Programming
    Replies: 2
    Last Post: 18th October 2011, 10:37
  3. Replies: 0
    Last Post: 23rd February 2011, 17:36
  4. Remove element of xml
    By VitaliBR in forum Newbie
    Replies: 17
    Last Post: 16th February 2011, 14:28
  5. Help with QML Pathview element
    By chetu1984 in forum Newbie
    Replies: 0
    Last Post: 7th February 2011, 05:49

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
  •  
Qt is a trademark of The Qt Company.