I’m trying to read in some saved settings from xml into a ValueTree. The saved file looks fine, but when I try and load the file, the resulting ValueTree XML only contains an empty main element with no attributes.
The first version of my file to xml to ValueTree code:
File settingsFile (settingsPath);
XmlDocument settingsDocument (settingsFile);
ScopedPointer<XmlElement> xml (XmlDocument::parse (settingsFile));
if (settingsFile.existsAsFile() && xml != nullptr)
{
DBG ("Loading settings from " << settingsFile.getFullPathName());
valueTree.fromXml(*xml);
DBG (valueTree.toXmlString());
}
then I tried using ValueTree::readFromStream
but with the same result:
FileInputStream is(settingsFile);
valueTree = ValueTree::readFromStream(is);
DBG ("Loading from file " << settingsFile.getFullPathName());
DBG (valueTree.toXmlString());
Is there something obvious I’m missing here?