Skip to content

Instantly share code, notes, and snippets.

@MonteLogic
Created March 22, 2021 14:59
Show Gist options
  • Save MonteLogic/78813cb9deb36219514f561cd7ddf199 to your computer and use it in GitHub Desktop.
Save MonteLogic/78813cb9deb36219514f561cd7ddf199 to your computer and use it in GitHub Desktop.
XML Parsing - Why is 4 and 5 printing but not 6 or 7?
<PATHS>
<PATH ID="02">C:\Users\foo\Desktop\AudioFileTwo.mp3 </PATH>
</PATHS>
/*
==============================================================================
LoadSaveXml.h
Created: 22 Mar 2021 5:02:11am
Author: dc
==============================================================================
*/
#pragma once
#include <JuceHeader.h>
//==============================================================================
/*
*/
class LoadSaveXml : public juce::Component
{
public:
LoadSaveXml()
{
// In your constructor, you should add any child components, and
// initialise any special settings that your component needs.
Logger::outputDebugString("Statement 4, This statement is coming from LoadSaveXml.h , gracias");
loadData();
}
~LoadSaveXml() override
{
}
void loadData() {
Logger::outputDebugString("Statement 5, This statement is inside the method loadData");
auto dir = juce::File::getCurrentWorkingDirectory();
auto myxmlfile = dir.getChildFile("resources").getChildFile("filepaths.xml");
if (myxmlfile.exists())
{
xmlMadeThing = juce::XmlDocument::parse(myxmlfile);
// madeList = xmlMadeThing->getChildByName("PATH");
if (xmlMadeThing->hasTagName("foobar"))
{
// ...etc
Logger::outputDebugString("Statement 6, foobar is being read, thus this method has faulty logic.");
}
if (xmlMadeThing->hasTagName("PATH"))
{
Logger::outputDebugString("Statement 7, The xml file is being read and parsed");
// ...etc
}
}
}
void resized() override
{
// This method is where you should set the bounds of any child
// components that your component contains..
}
private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LoadSaveXml)
std::unique_ptr<juce::XmlElement> xmlMadeThing;
juce::XmlElement* madeList = nullptr;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment