static Document & getDoc() { if (singleton) { return *singleton; } singleton = new Document; Document & doc = *singleton; doc.setDoctype(Doctype("html", "html.dtd")); AttList attributes; list<Content*> childs; ProcessingInstruction* se = new ProcessingInstruction(ElementName("", "xml")); attributes.push_back(Attribut("version", "2.0")); attributes.push_back(Attribut("encoding", "utf8")); se->setAttList(attributes); doc.setXmlProlog(se); Element* root = new Element; root->setName(ElementName("", "html")); doc.setRoot(root); Element* head = new Element; head->setName(ElementName("", "head")); list<Content*> headChildren; Element* title = new Element; title->setName(ElementName("", "title")); list<Content*> titleChild; Data* titleContent = new Data("Bienvenue"); titleChild.push_back(titleContent); title->setChildren(titleChild); headChildren.push_back(title); head->setChildren(headChildren); childs.push_back(head); Element* body = new Element; body->setName(ElementName("", "body")); childs.push_back(body); root->setChildren(childs); Element* element = new Element; element->setName(ElementName("", "a")); attributes.clear(); attributes.push_back(Attribut("alt", "Google.fr")); attributes.push_back(Attribut("href", "http://www.google.fr")); element->setAttList(attributes); EmptyElement* img = new EmptyElement; img->setName(ElementName("", "img")); attributes.clear(); attributes.push_back(Attribut("src", "http://www.google.fr/img.jpg")); img->setAttList(attributes); childs.clear(); childs.push_back(img); Data* data = new Data("Mon petit lien"); childs.push_back(data); Comment* comment = new Comment("<!-- Ceci est un commentaire. -->"); childs.push_back(comment); element->setChildren(childs); childs.clear(); childs.push_back(element); body->setChildren(childs); return doc; }