Is it too late for you to store the ValueTree as binary data (using writeToStream) into your plugin’s state? (I don’t even understand what benefit the conversion to XML would even have…The host stores the plugin data as binary anyway.)
You can export it to an XML by converting the var array to a delimited string. Take a look at the ValueWithDefault::varArrayToDelimitedString() and ::delimitedStringToVarArray() methods in juce_data_structures.
Yeah, I don’t understand why the tutorials do the seemingly unnecessary conversion into XML…(Since XML doesn’t even support the same data types directly as ValueTree.) @jules