QXmlSerializer, getting attribute and value from serializer
Hi everyone,
I am using XQuery to grab a node from an XML document, everything works fine up till this point. I don't know what to do next.
Problem description:
I need to grab the attribute and the value from a single node that looks like this
Code:
<strong class="class1">0.0376</strong>
to get this node I used
Code:
QXmlQuery queryxml;
queryxml.setQuery(xq.arg(query));
QXmlSerializer serializer(queryxml, &buffer);
if (queryxml.isValid()) {
queryxml.evaluateTo(&serializer);
qDebug() << "output: " << output;
}
The reason I need to get the attribute is that class name will sometimes be "class2" and depending on that I need to do different things with the 0.0376 value.
http://doc.trolltech.com/snapshot/qx...odelindex.html suggested to use an XML receiver to get attributes, names and child nodes, so I did that, but have no idea how to proceed and haven't seen any examples of this.
So my question is: How to get the attribute and value of the node using either code above or other code that uses XQuery;
Thanks,
josh
Re: QXmlSerializer, getting attribute and value from serializer
it is easy just put "@" befor name of attribute
like this
Code:
QXmlQuery query;
query.setQuery("doc('index.html')/html/body/@onload"); // getting onload event of html document
for value you need