1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Added handy new function parseXMLIfTagMatches(), and refactored a lot of old code that was parsing XML in a more clunky way

This commit is contained in:
jules 2019-05-19 08:13:20 +01:00
parent 3b36c3e198
commit 0fb8c8e82a
20 changed files with 130 additions and 148 deletions

View file

@ -180,14 +180,8 @@ std::unique_ptr<Drawable> Drawable::createFromImageData (const void* data, const
}
else
{
auto asString = String::createStringFromData (data, (int) numBytes);
XmlDocument doc (asString);
std::unique_ptr<XmlElement> outer (doc.getDocumentElement (true));
if (outer != nullptr && outer->hasTagName ("svg"))
if (auto svg = doc.getDocumentElement())
result = Drawable::createFromSVG (*svg);
if (auto svg = parseXMLIfTagMatches (String::createStringFromData (data, (int) numBytes), "svg"))
result = Drawable::createFromSVG (*svg);
}
return result;