tinyxml2 icon indicating copy to clipboard operation
tinyxml2 copied to clipboard

Mutable visitor

Open petko opened this issue 6 years ago • 2 comments
trafficstars

I need a visitor, which allows me to transform some DOM element from one type to another (changing its Name). However the TinyXML2 Visitor provides only const element access.

Is there any specific reason why the elements have to be const aside from the potential use of deleteNode(element)? What else could go wrong if the element is mutable?

petko avatar Mar 02 '19 09:03 petko

I'm not sure what could go wrong; haven't really thought it through. Seems like a tricky approach. Is it possible to change the original DOM or generate a new one?

leethomason avatar Mar 18 '19 00:03 leethomason

I prefer to change the existing one for performance reasons. I ended up const_casting the element I want to change. Not the most elegant solution, but probably does no harm..

petko avatar Mar 18 '19 20:03 petko