Menu

how to removeChild by name?

mrasmu
2004-10-25
2013-05-20
  • mrasmu

    mrasmu - 2004-10-25

    Im a newbie with TinyXml, and I have a file that I wish to remove a specific child by name.

    The following code is removing the nextSiblingElement.

    node = usersElement->FirstChild( "User" );
    userElement = node->NextSiblingElement( );
    usersElement->RemoveChild( userElement );

    Is it possible to remove the child by using an attribute "name"?

     
    • daixiaofei

      daixiaofei - 2004-11-11

      may be you can add this funcation to the TiXmlNode class:
      bool TiXmlNode::DeleteThis()
      {
          TiXmlNode *node =this;
          TiXmlNode *fparent =node->Parent();
          return fparent->RemoveChild(node);
      }

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.