Constructs a descendant markup iterator. A descendant markup
iterator is usually initialized upon creation, normally by calling markup::descendant_begin() or from a return value from a search algorithm.
Complexity
Constant
Example
#include "xhtml_doc.h"
#include "xport_brochure.h"
#include <iostream>
#include <algorithm>
struct comp_by_id
{
comp_by_id(const std::string& s) : id_str(s) {}
bool operator() (const Xport::markup& mkup) { return mkup.attribute(Xport::id) == id_str; }
std::string id_str;
};
int main(int argc, char* argv[])
{
using namespace Xport;
// create a root document
document doc(root_doc);
// populate the document
xport_brochure broch;
broch.create(doc);
// find a specific element in the document by element id
markup::const_descendant_iterator it = std::find_if(doc.descendant_begin(), doc.descendant_end(), comp_by_id("
class_categories"));
if (it != doc.descendant_end()) {
std::cout << "Found the element with id = 'class_categories'" << "\n\n";
// send the element to cout
formatter fmtr(std::cout);
fmtr << *it;
std::cout << "\n\n";
}
}
Datasoft Solutions is proud to present their landmark product, Work Time Studio. Utilizing the tree container library, Work Time Studio provides
unparalleled features in personal time, project and task management
software. If you're looking for a way to increase your productivity,
visit Work Time Studio's product website, and start being more productive
today.