struct tagElem {
wchar_t tagName[20];
wchar_t value[256];
int status;
tagElem *parent;
tagElem *firstChild;
tagElem *nextChild;
int output(TTreeNodes*, tagElem*, int);
};
int tagElem::output(TTreeNodes *treeNode, tagElem *printNode, int index) {
if (treeNode->GetFirstNode() == NULL) {
treeNode->Add(NULL, printNode->tagName);
}
if (printNode->firstChild != NULL) {
printNode = printNode->firstChild;
treeNode->AddChild(treeNode->Item[index], printNode->tagName);
printNode->output(treeNode,printNode, index+1);
}
printNode = this;
if (printNode->nextChild != NULL) {
printNode = this->nextChild;
treeNode->Add(treeNode->Item[index], printNode->tagName);
index = printNode->output(treeNode,printNode, index+1);
}
return index;
}
firstChild points to the first element of the sequence of "children" of the "parent" Element. So because of index this code working wrong. Can't figure out by my self. Can't find other ways to fill this tree. May be i shoudn't use Add() and AddChild() functions? Didn't find equival replacement.