Results 1 to 5 of 5

Thread: Can QXmlStreamReader parse <yweather:condition text = "" high = "" ...> ?

  1. #1
    Join Date
    Feb 2010
    Posts
    12
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Can QXmlStreamReader parse <yweather:condition text = "" high = "" ...> ?

    In my demo, when I use

    if(reader.name() == "yweather:condition")
    {
    ...
    }

    but it seems that "reader.name == yweather.condition" never be true. How can I parse this "yweather:condition" use QXmlStreamReader? Some one help me, thanks a lot.

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Can QXmlStreamReader parse <yweather:condition text = "" high = "" ...> ?

    What type is reader? The problem is that the first part is tne namespace and only the second the name. so you have to check both. E.g. QXmlStreamAttribute::name() and QXmlStreamAttribute::prefix(). Or use direct QXmlStreamAttribute::qualifiedName().

  3. #3
    Join Date
    Feb 2010
    Posts
    12
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Can QXmlStreamReader parse <yweather:condition text = "" high = "" ...> ?

    Quote Originally Posted by Lykurg View Post
    What type is reader? The problem is that the first part is tne namespace and only the second the name. so you have to check both. E.g. QXmlStreamAttribute::name() and QXmlStreamAttribute::prefix(). Or use direct QXmlStreamAttribute::qualifiedName().
    The type of reader is QXmlStreamReader, it can recognize other name , but cannot recognize this yweather:condition

  4. #4
    Join Date
    Feb 2010
    Posts
    12
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Can QXmlStreamReader parse <yweather:condition text = "" high = "" ...> ?

    I find the reason, every time the reader read the name after : , for example, <yweather:condition ******> , reader.name() returns "condition" but not "yweather:condition"

  5. #5
    Join Date
    Jan 2010
    Posts
    73
    Thanks
    6
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Can QXmlStreamReader parse <yweather:condition text = "" high = "" ...> ?

    Yes, this is what lykurg said. The name is condition. yweather is part of the prefix.

Similar Threads

  1. Replies: 3
    Last Post: 8th December 2011, 19:21
  2. Replies: 3
    Last Post: 15th February 2010, 17:27
  3. Replies: 3
    Last Post: 8th July 2008, 19:37
  4. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05
  5. QFile Problem~ "Unknow error" in "open(QIODevice::ReadWrite)"
    By fengtian.we in forum Qt Programming
    Replies: 3
    Last Post: 23rd May 2007, 15:58

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.