PDA

View Full Version : QXmlStreamAttribute name and value?



warry
14th August 2008, 13:47
I'm using the QXmlStreamReader to parse an xml doc and after I get to a tag and check for any attributes, I'd like to pull the name and value of the attribute into a QString. But I'm not sure how to do this after looking over the docs. I got this so far

QXmlStreamAttribute att = reader->attributes().at(0);

but I don't see any way to access the strings in the att, if that's really what's in there. Could anyone tell me what functions I use from this point to access the name and value of the att that got pulled from a tag?

spirit
14th August 2008, 14:01
QXmlStreamAttribute att = reader->attributes().at(0);
QString name = att.name().toString();
QString value = att.value().toString();

???

warry
14th August 2008, 14:23
Guess these were the wrong docs http://doc.trolltech.com/4.4/qxmlstreamattributes.html

Thanks alot.

spirit
14th August 2008, 14:27
Guess these were the wrong docs http://doc.trolltech.com/4.4/qxmlstreamattributes.html

Thanks alot.

that's it what you need
QXmlStreamAttribute