The Great Gatsby F. Scott Fitzgerald To Kill a Mockingbird Harper Lee The Catcher in the Rye J.D. Salinger
TiXmlDocument doc("books.xml"); bool loadOkay = doc.LoadFile(); if (loadOkay) { TiXmlElement* root = doc.FirstChildElement("bookstore"); for (TiXmlElement* book = root->FirstChildElement(); book != nullptr; book = book->NextSiblingElement()) { TiXmlElement* title = book->FirstChildElement("title"); if (title != nullptr) { std::cout << title->GetText() << std::endl; } } }In this example, we first load the XML file into a TiXmlDocument object. Then, we get the root element using FirstChildElement. After that, we loop through each book element using NextSiblingElement and get the title element using FirstChildElement. Finally, we print the text of the title element. Package/library: TinyXML.