Returns a pointer to the head element, if present.
markup* document::head();1st Variety
const markup* document::head() const;2nd Variety
Parameters
none
Returns
A pointer to the head element, if present. If the head element isn't present, returns NULL.
Remarks
This operation is one of the more common operations in document. This operation allows a very convienient way to access
markup objects in the head of the document, and to add markup to the head as well. This function can also be called to check or
verify that the head element exists.
Complexity
Constant
Example
#include "xhtml_doc.h"
#include "xport_brochure.h"
#include <string>
#include <iostream>
int main(int argc, char* argv[])
{
using namespace Xport;
// create an xhtml strict root document
document doc(root_doc);
stylesheet ss;
// populate document
std::cout << "Creating Xport Brochure.\n";
xport_brochure broch;
broch.create(doc, ss);
// determine title of document
markup::iterator it = doc.head()->begin();
for (; it != doc.head()->end(); ++it) {
if (it->tag() == Xport::title) {
// found title element. verify it has contents
if (!it->empty()) {
std::ostringstream ostr;
formatter fmtr(ostr);
it->begin()->write(fmtr);
std::cout << "The title of the Xport Brochure document is '" << ostr.str() << "'\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.