I have a picture frame anchored in a story. This picture frame is tagged. I need to delete it.
For this purpose, I can get access to the XMLReference of the tag through an Id. From here, I tried unsucessfully to delete the xml element (IXMLElementCommands::DeleteElement(...)), or delete the content inside the element (ITextModelCmds::DeleteCmd(...) after retrieving the range with IXMLUtils::GetElementIndices(...) or IXMLUtils::GetElementMarkerPositions(...)), or both of them. In each case, at the closure of the document, I have asserts :
"~InstanceList(): 1 outstanding references to UID 170 (Class kSBOSPageBoss)."
It is as if there were still a reference on the deleted anchored frame. In the solution guide, it just tells to delete the anchored character to delete the associated anchored frame. Did I miss something ?
Something weird is that IXMLUtils::GetElementIndices(...) or IXMLUtils::GetElementMarkerPositions(...) give me start index at 0 and end index at -1. However, the xml element is found...
I found a partial solution. The reason why I had those outstanding bosses was I didn't call the right InterfacePtr constructor when I called XMLReference::Instantiate().
I did :
InterfacePtr<IIDXMLElement> element(xmlReference.Instantiate(), UseDefaultIID());
Now, a last problem remains :
Utils<IXMLUtils>()->CalculateStartEndTextIndex(element, element->GetChildCount(), start, end);
always give me start = 0 and end = 0 ...
My element exists in the story though. I'm sure of it because it's the result of a search. So what ?
Europe, Middle East and Africa