diff --git a/modules/juce_data_structures/values/juce_ValueTree.cpp b/modules/juce_data_structures/values/juce_ValueTree.cpp index 98041aee4d..874cf6453b 100644 --- a/modules/juce_data_structures/values/juce_ValueTree.cpp +++ b/modules/juce_data_structures/values/juce_ValueTree.cpp @@ -976,6 +976,12 @@ ValueTree ValueTree::fromXml (const XmlElement& xml) return v; } +String ValueTree::toXmlString() const +{ + const ScopedPointer xml (createXml()); + return xml != nullptr ? xml->createDocument (String::empty) : String::empty; +} + //============================================================================== void ValueTree::writeToStream (OutputStream& output) const { diff --git a/modules/juce_data_structures/values/juce_ValueTree.h b/modules/juce_data_structures/values/juce_ValueTree.h index 6e1101a676..d8f7b47cab 100644 --- a/modules/juce_data_structures/values/juce_ValueTree.h +++ b/modules/juce_data_structures/values/juce_ValueTree.h @@ -334,6 +334,11 @@ public: */ static ValueTree fromXml (const XmlElement& xml); + /** This returns a string containing an XML representation of the tree. + This is quite handy for debugging purposes, as it provides a quick way to view a tree. + */ + String toXmlString() const; + //============================================================================== /** Stores this tree (and all its children) in a binary format.