c++ - QTDom - recursively add child to specific elements -


i have few xml files, , of it's nodes contains "reference" each other. want add content of xml child nodes, contains references

void gameobject::expandnode(qdomelement& expnode) {      if ((expnode.tagname() == "instance" && expnode.attribute("type") == "library") ||          (expnode.tagname() == "library" && expnode.hasattribute("file")))     {         qstring filename;         if (expnode.tagname() == "instance" )             filename = findlib(expnode.attribute("definition")).attribute("file");         else             filename = expnode.attribute("file");         qfile nestedfile(filename);         qdomdocument nestedlib;         nestedlib.setcontent(&nestedfile);         qdomelement nestednode = libdoc->createelement("nestedlibrary");         nestednode.setattribute("path", filename);         nestednode.appendchild(nestedlib);         expnode.appendchild(nestednode);     }      qdomnode childnode = expnode.firstchild();     while (!childnode.isnull())     {         if (childnode.iselement())             expandnode(childnode.toelement());         childnode = childnode.nextsibling();     } } 

but got no matching function call 'gameobject::expandnode(qdomelement)' expandnode(childnode.toelement());

how can right? ^

it wrong decision - call expandnode, using temporary object. solution is

qdomnode childnode = expnode.firstchild(); while (!childnode.isnull()) {     if (childnode.iselement())     {         qdomelement childelem = childnode.toelement();         expandnode(childelem);     }     childnode = childnode.nextsibling(); } 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -