Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #81044
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2014-11-19 13:43 -0800 |
| References | <m4j0rj$vis$1@dont-email.me> |
| Message-ID | <ab8be359-503f-4e0b-b157-66815687923b@googlegroups.com> (permalink) |
| Subject | Re: Working with HTML5 documents |
| From | Novocastrian_Nomad <gregory.j.baker@gmail.com> |
On Wednesday, November 19, 2014 2:08:27 PM UTC-7, Denis McMahon wrote:
> 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:
>
> <!doctype HTML><html><head><title>This Is The Title</title></
> head><body><p>This is some text.</p></body></html>
>
> 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,
Use a search engine (Google, DuckDuckGo etc) and search for 'python write html'
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Working with HTML5 documents Denis McMahon <denismfmcmahon@gmail.com> - 2014-11-19 21:08 +0000
Re: Working with HTML5 documents Novocastrian_Nomad <gregory.j.baker@gmail.com> - 2014-11-19 13:43 -0800
Re: Working with HTML5 documents Denis McMahon <denismfmcmahon@gmail.com> - 2014-11-20 17:03 +0000
Re: Working with HTML5 documents Tim <jtim.arnold@gmail.com> - 2014-11-20 09:31 -0800
Re: Working with HTML5 documents Stefan Behnel <stefan_ml@behnel.de> - 2014-11-20 20:02 +0100
Re: Working with HTML5 documents Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-20 12:44 -0700
Re: Working with HTML5 documents Stefan Behnel <stefan_ml@behnel.de> - 2014-11-20 21:10 +0100
Re: Working with HTML5 documents Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-20 14:15 -0700
csiph-web