Returns a child markup iterator (or const_iterator in the second variety) pointing just past the last child markup object in the element.
Remarks
This operation is revelant only if it is called on a derived element derived object, because element is the only type
derived from markup which can contain children. This operation returns an iterator just past the last child markup object in the element.
If the called markup object is a const object, a const_iterator will be returned.
Complexity
Constant
Example
#include "xhtml_doc.h"
#include "xport_brochure.h"
#include <iostream>
#include <algorithm>
// function object for std::find_if
struct has_id
{
public:
has_id(const std::string& find_id) : id_val(find_id) {}
bool operator()(const Xport::markup& mkup) { return mkup.attribute(Xport::id) == id_val; }
private:
std::string id_val;
};
int main(int argc, char* argv[])
{
using namespace Xport;
// create an xhtml strict root doc and stylesheet
document doc(root_doc);
stylesheet ss;
// create Xport brochure
xport_brochure broch;
broch.create(doc, ss);
// traverse and output the element names of all elements in the main div element
markup::const_descendant_iterator dit = std::find_if(doc.descendant_begin(), doc.descendant_end(), has_id("content"));
if (dit != doc.descendant_end()) {
// traverse main div element
markup::const_iterator it = dit->begin();
for (; it != dit->end(); ++it) {
if (it->markup_type() == mt_element) {
std::cout << " " << it->tag_name();
// output any id attribute
if (!it->attribute(id).empty()) {
std::cout << " id='" << it->attribute(id) << "'";
}
// output any class attribute
if (!it->attribute(class_attribute).empty()) {
std::cout << " class='" << it->attribute(class_attribute) << "'";
}
std::cout << "\n";
}
}
}
return 0;
}
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.