I'm using the QXmlQuery class in Qt to do XQuery on a soap response. As the response contains two namespaces, I use the declare clauses (the second and the third lines in the code snippet below) to declare them first before using them in the Xpath expression.
QXmlQuery query;
declare namespace s = "http://www.w3.org/2003/05/soap-envelope";
declare namespace ms = "http://schemas.microsoft.com/sharepoint/soap/";
query.setQuery("doc($xmlDoc)/s:Envelope/s:Body/ms:GetListCollectionResponse/ms:GetListCollectionResult/ms:Lists/ms:List/string()");
However, I got the following errors when compiling the code. Does anybody know how to fix this?
src/QtHelloWorldMakeCommImpl.cpp:79: error: 'declare' was not declared in this scope
src/QtHelloWorldMakeCommImpl.cpp:79: error: expected ';' before 'namespace'
src/QtHelloWorldMakeCommImpl.cpp:80: error: expected ';' before 'namespace'
QXmlQuery, but it looks like you would try to declare the namespaces outside the query. There must be some function like query.declareNamespace or similar.