I have an XML file of which I need to extract data from. I use tinyxml2. I tried to get the text of an element in the file. The data in the file looks like this:
<Tasks>
<!-- \GoogleUpdateTaskMachineCore -->
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Version>1.3.33.7</Version>
<Description>Keeps your Google software up to date. If this task is disabled or stopped, your Google software will not be kept up to date, meaning security vulnerabilities that may arise cannot be fixed and features may not work. This task uninstalls itself when there is no Google software using it.</Description>
</RegistrationInfo>
<Actions Context="Author">
<Exec>
<Command>C:\Program Files (x86)\Google\Update\GoogleUpdate.exe</Command>
<Arguments>/c</Arguments>
</Exec>
</Actions>
</Task>
</Tasks>
I tried to extract Description
with the following code, however it doesn't work.
tinyxml2::XMLDocument xmlDoc; xmlDoc.LoadFile("raw"); XMLNode *pLoadTask = xmlDoc.FirstChild(); XMLElement * pTask = pLoadTask->FirstChildElement("Task")->FirstChildElement("RegistrationInfo")->FirstChildElement("Description");
What am I doing wrong?