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.
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().
Re: Can QXmlStreamReader parse <yweather:condition text = "" high = "" ...> ?
Quote:
Originally Posted by
Lykurg
The type of reader is QXmlStreamReader, it can recognize other name , but cannot recognize this yweather:condition
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"
Re: Can QXmlStreamReader parse <yweather:condition text = "" high = "" ...> ?
Yes, this is what lykurg said. The name is condition. yweather is part of the prefix.