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.
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.
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().
I find the reason, every time the reader read the name after : , for example, <yweather:condition ******> , reader.name() returns "condition" but not "yweather:condition"
Yes, this is what lykurg said. The name is condition. yweather is part of the prefix.
Bookmarks