Whole Function:
Qt Code:
  1. bool FieldModel::updateNode(QDomNode node,QString parent){
  2.  
  3. QDomElement rootOfTag=fieldState.firstChild().firstChildElement(parent);
  4. QDomNodeList sameTags=rootOfTag.elementsByTagName(node.firstChild().toElement().tagName());
  5. for(uint i=0;i<sameTags.length();i++){
  6. QDomNode nodeToReplace=sameTags.item(i);
  7. if(nodeToReplace.toElement().attribute("id")==node.firstChild().toElement().attribute("id")){
  8. rootOfTag.removeChild(nodeToReplace);
  9. qDebug()<<"Hello:\n"<<fieldState.toString();
  10. return true;
  11. }
  12. }
  13. insertNode(node,parent);
  14. return true;
  15. }
To copy to clipboard, switch view to plain text mode 

Its output from line 9.

Qt Code:
  1. Hello:
  2. "<FieldState>
  3. <Blocks>
  4. <Block id="3T">
  5. <OccupiedState>1</OccupiedState>
  6. <TanzimState>0</TanzimState>
  7. <ProtectionState>0</ProtectionState>
  8. <FailureState>0</FailureState>
  9. </Block>
  10. <Block id="001BT">
  11. <OccupiedState>1</OccupiedState>
  12. <TanzimState>0</TanzimState>
  13. <ProtectionState>0</ProtectionState>
  14. <FailureState>0</FailureState>
  15. </Block>
  16. </Blocks>
  17. <Switches/>
  18. <Signals/>
  19. <LevelCrossings/>
  20. <Routes/>
  21. </FieldState>
  22. "
To copy to clipboard, switch view to plain text mode 

fieldState is Class member and it is fine.