Results 1 to 3 of 3

Thread: QXmlStreamReader not reading text within tags

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2011
    Posts
    11
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Symbian S60

    Default QXmlStreamReader not reading text within tags

    I am trying to read the text in between xml tags using a simple QXmlStreamReader

    i have filled a QXmlStreamReader called sectionReader with xml from this link:http://www.waseet.net/apps/iphone/xm...ories-file.xml

    this code shows all start elements normally:
    void MainWindow:arseXml2()
    {
    while (!sectionReader.atEnd())
    {
    sectionReader.readNext();
    if(sectionReader.isStartElement())
    {
    ui->textEdit->append(sectionReader.name().toString());
    }
    }
    }

    whereas this code gives whitespaces:
    void MainWindow:arseXml2()
    {
    while (!sectionReader.atEnd())
    {
    sectionReader.readNext();
    if(sectionReader.isStartElement())
    {
    ui->textEdit->append(sectionReader.readElementText());
    }
    }
    }

    can anyone indicate what is going wrong? why aren't i reading any text in between the start and end tags?
    I can verify that the xml has text in between the tags. here is the link if anyone wants to check: http://www.waseet.net/apps/iphone/xm...ories-file.xml

    i have attached my .h and .cpp files along with the post
    Attached Files Attached Files

Similar Threads

  1. Reading and rereading a file with QXmlStreamReader
    By TheRonin in forum Qt Programming
    Replies: 14
    Last Post: 30th April 2015, 14:04
  2. QTextEdit <body> tags text only
    By certqt in forum Qt Programming
    Replies: 3
    Last Post: 22nd January 2011, 13:11
  3. how to use html tags(rich text) in QTableWidgetHeaderItem
    By ansmehta in forum Qt Programming
    Replies: 0
    Last Post: 13th December 2010, 10:20
  4. Replies: 0
    Last Post: 26th May 2010, 19:01
  5. Getting All Text Between Tags in XML ?
    By seanmu13 in forum Qt Programming
    Replies: 1
    Last Post: 8th June 2007, 16:29

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.