[Qt-interest] Xquery error: Attribute can't be serialized

Akshey Jawa aksheyjawa at gmail.com
Mon Oct 26 13:19:22 CET 2009


Hi,

While using xquery, I am getting this error:

*Error SENR0001: Attribute 'type' can't be serialized because it appears at
the top level.*


My code is like this-


* query.setQuery("doc('quiz.xml')/quiz/question[1]/@type");
query.evaluateTo( new QXmlSerializer(query, myOutputDevice2) );
QMessageBox::information( 0, "Ques" ,
QString(myOutputDevice2->data()).trimmed() );*


and XML is like this-

* <quiz>
<question number="1" type='sometype' >
<statement>Something something</statement>
</question>*

* </quiz>
*

I want only the value of the 'type' attribute to be displayed by
QMessageBox::information(). How is it possible?*

*If I change the Xquery to
*        query.setQuery("<something>
{doc('quiz.xml')/quiz/question[1]/@type} </something>");*
then QMessageBox::information() displays *<something
type='sometype'></something>* but I want to display only the value of the
'type' attribute (i.e. 'sometype').

Please help

Regards,
Akshey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091026/0dec29f7/attachment.html 


More information about the Qt-interest-old mailing list