Hello, i need to create a function to remove a whole xml Node, in my case i need to remove the node starting with "group" tag.
This is a my xml file snip:
Qt Code:
  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <twm version="1.0" modify_date="2008-03-06T13:03:19" creation_date="2008-03-06T13:03:19">
  3. <group name="test" > // remove
  4. <option key="key" tagName="tagValue" /> // remove
  5. </group> // remove
  6. </twm>
To copy to clipboard, switch view to plain text mode 
and this is the code used to remove the node, but it doesn not work.
Qt Code:
  1. bool twmXMLObject::removeGroup ( QDomDocument * twmDomDocument , QString theGroupName )
  2. {
  3. QDomNodeList domTwm = twmDomDocument->elementsByTagName( "group" );
  4.  
  5. if ( !domTwm.isEmpty() )
  6. {
  7. for ( uint i = 0; i < domTwm.length(); i++ )
  8. {
  9. if ( domTwm.at(i).toElement().attribute( "name" ) == theGroupName )
  10. {
  11. twmDomDocument->removeChild( domTwm.at(i) );
  12. }
  13. }
  14. }
  15. }
To copy to clipboard, switch view to plain text mode 
After call the function removeGroup i save the xml file.
Any idea?
thx