ValueTree::fromXml() and textElements


I noticed that using ValueTree::fromXml(myXmlElement) seems to have some issues if myXmlElement contains a TextElement :

ScopedPointer <XmlElement> state(new XmlElement("drumsetState"));
ValueTree testTree(ValueTree::fromXml(*state));

The above code causes an assertion error:
JUCE Assertion failure in /Users/aaronleese/juce/amalgamation/…/src/containers/juce_Identifier.cpp, line 61

Because the code wants a TagName to exist on the child textElement.

There are plenty of workarounds, of course, but it wouldn’t be bad to have some way to support textElements in ValueTree’s either.


The ValueTree isn’t designed for parsing random XML - I think I made that pretty clear in the docs for ValueTree::fromXML(). They can save and reload their state as XML, but that’s very different from being able to load any XML file as a ValueTree.


ah, fair enough.

I’m rewriting a bunch of save functions, and finding different ways to do it. Nice to have a bunch of options, and love the ValueTree class … so trying to use it a bunch but for the right things. Thanks.