| 290 | |
| 291 | |
| 292 | TiXmlNode* TiXmlNode::ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis ) |
| 293 | { |
| 294 | if ( replaceThis->parent != this ) |
| 295 | return 0; |
| 296 | |
| 297 | TiXmlNode* node = withThis.Clone(); |
| 298 | if ( !node ) |
| 299 | return 0; |
| 300 | |
| 301 | node->next = replaceThis->next; |
| 302 | node->prev = replaceThis->prev; |
| 303 | |
| 304 | if ( replaceThis->next ) |
| 305 | replaceThis->next->prev = node; |
| 306 | else |
| 307 | lastChild = node; |
| 308 | |
| 309 | if ( replaceThis->prev ) |
| 310 | replaceThis->prev->next = node; |
| 311 | else |
| 312 | firstChild = node; |
| 313 | |
| 314 | delete replaceThis; |
| 315 | node->parent = this; |
| 316 | return node; |
| 317 | } |
| 318 | |
| 319 | |
| 320 | bool TiXmlNode::RemoveChild( TiXmlNode* removeThis ) |