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

Added some free functions to help make XML parsing less verbose: parseXML()

This commit is contained in:
jules 2018-10-15 16:08:25 +01:00
parent 97c100b9c1
commit 768139a298
23 changed files with 116 additions and 94 deletions

View file

@ -849,20 +849,21 @@ namespace WavFileHelpers
{
static void addToMetadata (StringPairArray& destValues, const String& source)
{
std::unique_ptr<XmlElement> xml (XmlDocument::parse (source));
if (xml != nullptr && xml->hasTagName ("ebucore:ebuCoreMain"))
if (auto xml = parseXML (source))
{
if (auto* xml2 = xml->getChildByName ("ebucore:coreMetadata"))
if (xml->hasTagName ("ebucore:ebuCoreMain"))
{
if (auto* xml3 = xml2->getChildByName ("ebucore:identifier"))
if (auto xml2 = xml->getChildByName ("ebucore:coreMetadata"))
{
if (auto* xml4 = xml3->getChildByName ("dc:identifier"))
if (auto xml3 = xml2->getChildByName ("ebucore:identifier"))
{
auto ISRCCode = xml4->getAllSubText().fromFirstOccurrenceOf ("ISRC:", false, true);
if (auto xml4 = xml3->getChildByName ("dc:identifier"))
{
auto ISRCCode = xml4->getAllSubText().fromFirstOccurrenceOf ("ISRC:", false, true);
if (ISRCCode.isNotEmpty())
destValues.set (WavAudioFormat::ISRC, ISRCCode);
if (ISRCCode.isNotEmpty())
destValues.set (WavAudioFormat::ISRC, ISRCCode);
}
}
}
}