This is probably a novice question, but I am new to tinyxml2 and can't find anything about this.
I am trying to loop through a XML file using tinyxml2.
<images>
<correctImage>image1.png</correctImage>
<image>image2.png</image>
<image>image3.png</image>
</images>
I have the XMLElement of the image element, but I am not sure how to get the inside elements.
Any hand would be appreciated.
For the record, this is how I get the XML element:
tinyxml2::XMLElement *levelElement = doc.FirstChildElement("reactor")->FirstChildElement("level")->FirstChildElement("images");
Thanks in advance.
You do it the same way you're doing it now, except you don't specify the value of the element you are looking for.
E.g.
tinyxml2::XMLElement *levelElement = doc.FirstChildElement("reactor")->FirstChildElement("level")->FirstChildElement("images");
for (tinyxml2::XMLElement* child = levelElement->FirstChildElement(); child != NULL; child = child->NextSiblingElement())
{
// do something with each child element
}