View Full Version : Can QXmlStreamReader parse <yweather:condition text = "" high = "" ...> ?
kellen851105
4th March 2010, 12:37
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.
Lykurg
4th March 2010, 13:19
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().
kellen851105
4th March 2010, 13:49
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
kellen851105
4th March 2010, 14:31
I find the reason, every time the reader read the name after : , for example, <yweather:condition ******> , reader.name() returns "condition" but not "yweather:condition"
pitonyak
5th March 2010, 18:03
Yes, this is what lykurg said. The name is condition. yweather is part of the prefix.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.