Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Denis McMahon Newsgroups: comp.lang.python Subject: Working with HTML5 documents Date: Wed, 19 Nov 2014 21:08:03 +0000 (UTC) Organization: A noiseless patient Spider Lines: 33 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Wed, 19 Nov 2014 21:08:03 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="66ffcfa4470a58bcddbdcd1913f98ab4"; logging-data="32348"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/E4FZLsG2GxqO5GMtQOqYG2k/cTrtVhEg=" User-Agent: Pan/0.136 (I'm far too busy being delicious; GIT 926a150 git://git.gnome.org/pan2) Cancel-Lock: sha1:kKOiL0x8WpaLZz0iemzNWYrZYbM= Xref: csiph.com comp.lang.python:81042 So what I'm looking for is a method to create an html5 document using "dom manipulation", ie: doc = new htmldocument(doctype="HTML") html = new html5element("html") doc.appendChild(html) head = new html5element("body") html.appendChild(head) body = new html5element("body") html.appendChild(body) title = new html5element("title") txt = new textnode("This Is The Title") title.appendChild(txt) head.appendChild(title) para = new html5element("p") txt = new textnode("This is some text.") para.appendChild(txt) body.appendChild(para) print(doc.serialise()) generates: This Is The Title

This is some text.

I'm finding various mechanisms to generate the structure from an existing piece of html (eg html5lib, beautifulsoup etc) but I can't seem to find any mechanism to generate, manipulate and produce html5 documents using this dom manipulation approach. Where should I be looking? -- Denis McMahon, denismfmcmahon@gmail.com