How to put XmlElement* into var?


What is the best way to wrap an XmlElement* (created via a factory method) into a ReferenceCountedObject so that it can be stored in a var? Thanks


If performance isn’t an issue, then just convert it to a string?




or convert it to a ValueTree and stream it into a memory-block should also work, and its binary compatible (floats!!) and maybe faster too, cause String-handling (re-parsing) is always very slow!


If you’re suggesting doing this via “ValueTree::fromXml (const XmlElement &xml)”, it doesn’t work. It is a little picky and only seems to like XmlElements generated from a ValueTree. In fact, the final destination of the data is a ValueTree, but I decided to make the question title a little less specific.

Even more awesome would be if Jules added an interface to TreeView component allowing the user to get the openness-state data as a ValueTree, and making the TreeView a ValueTree::Listener . . . hint hint hint hint :wink:


That is a pretty cool idea. ValueTrees didn’t exist when I first created the TreeView, which is why it just uses XML but it’d be a good use for them.


It would certainly make the API that bit more cohesive looking at the Slider class etc. I’d be super grateful if you’d put it in (when convenient) :mrgreen:


Bump. Any plans for Value enabled TreeView?


sorry, too many other things to do right now!


No problem. Was just enquiring so I can plan where to focus my efforts. Keep up the great work, Jules!