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

Girish Ramakrishnan girish at forwardbias.in
Mon Oct 26 18:06:28 CET 2009


I am not 100% sure but it looks like a Qt bug.

This xquery works - data(doc('quiz.xml')/quiz/question[1]/@type)

Girish

Akshey Jawa wrote:
> 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



More information about the Qt-interest-old mailing list