SVG format


#1

i’m getting SVGs that wont load.

It seems that some of them have bogus namespace attributes on their tags. for example the outer “svg” tag is “svg:svg” and then all of the inner ones repeat the same namespace eg “svg:g”. Presumably you can have anything here (not sure) eg “moose:svg” followed by “moose:g”.

Anyhow, i’ve hacked my version to ignore any namespace (i dont do any consistency check and not sure if i care).

juce_XmlElement.cpp

[code]bool XmlElement::hasTagName (const String& tagNameWanted) const noexcept
{
// ignore any namespace prefix (eg svg:svg, svg:g etc).
String t = tagName.fromLastOccurrenceOf(":", false, false);

#if JUCE_DEBUG
// if debugging, check that the case is actually the same, because
// valid xml is case-sensitive, and although this lets it pass, it’s
// better not to…
if (t.equalsIgnoreCase (tagNameWanted))
{
jassert (t == tagNameWanted);
return true;
}
else
{
return false;
}
#else
return t.equalsIgnoreCase (tagNameWanted);
#endif
}[/code]

fixes it for me.


#2

Ta for the heads-up - I’ve added a fix for that now.