I want delete all documents retrieved by query. I am using c++ an my code is:
…
TaminoCommand* inoCommand = m_Tamino->CreateCommand(collection);
TaminoQuery* inoQuery = new TaminoQuery(query);
TaminoQueryResponse* inoResp = inoCommand->Query(inoQuery);
if(!inoResp->HasData)
return;
TaminoItemIterator* it = inoResp->GetItemIterator();
while(it->Next()){
TaminoDocument* inoDoc = dynamic_cast<TaminoDocument*>(it->GetItem(__typeof(TaminoDocument)));
inoCommand->Delete(inoDoc);
}
i doesn’t run because line “dynamic_cast<TaminoDocument*>(it->GetItem(__typeof(TaminoDocument)));” throw a WebException.
What’s wrong ?
Finally, in documentation a find the class “TaminoXmlDocument”, but I can use it from c++, why ?
thanks
One would normally use GetNode to get nodes. GetItem is used when you wish to get the node back as a particular “type”. In this case the type you wish the node to be must have a corresponding serializer generated using the .NET xsd tool from an .xsd type descriptor. This explains the dynamic cast exception.
I suspect that the use of TaminoDocument is incorrect in GetItem. This is why the example serializer TaminoXmlDocument is provided.
TaminoXmlDocument is under the Serialization namespace: SoftwareAG.Tamino.Api.Serialization.
By the way I suspect that you might be able to delete documents using XQuery. Unfortunately the website Find is not working at the moment.
I knew I had seen XQuery delete on documents.
It is detailed in this forum message:
http://tamino.forums.softwareag.com/viewtopic.php?p=2980
i test it and It run, thanks for all