Hi,
I got a non expected behaviour in a mdl function.
The function should strip all database linkages from sub elements in a complex element.
Instead, the linkages for the first sub element are not stripped correctly.
Here is the snippet:
int intern_database_deleteSubLinkages_efunc(MSElementUnion *el, void *p,DgnModelRefP modelRef,MSElementDescr *e,MSElementDescr **pe) {
int length;
short attributes[MAX_ATTRIBSIZE];
length=0;
mdlElement_extractAttributes(&length,attributes,el);
if (length>0) {
mdlElmdscr_new(pe,NULL,el);
mdlElmdscr_stripAttributes(pe);
return MODIFY_STATUS_REPLACEDSCR;
}
return MODIFY_STATUS_NOCHANGE;
int do() {
mdlModify_elementDescr2(e,mdlModelRef_getActive(),MODIFY_REQUEST_NOHEADERS,intern_database_deleteSubLinkages_efunc,NULL,0);
Unknown said:The linkages for the first sub element are not stripped correctly
Do you mean that some of the linkages are stripped, and some not; or do you mean that no linkage is stripped from the first component?
What about the remaining components: are linkages stripped from those?
Regards, Jon Summers LA Solutions
Is it each time the first element ? Any chance that this sub is a complex header itself (textnode, complex string) ?
Just some thoughts.
btw. I normally use mdlElmdscr_duplicateSingle(pe, e); instead of creating a new Elmdescr for MODIFY_STATUS_REPLACEDSCR, but this should make no difference.