CARVIEW |
Select Language
HTTP/2 302
server: nginx
date: Thu, 31 Jul 2025 06:20:39 GMT
content-type: text/plain; charset=utf-8
content-length: 0
x-archive-redirect-reason: found capture at 20071208112101
location: https://web.archive.org/web/20071208112101/https://wiki.python.org/moin/LearnPython
server-timing: captures_list;dur=0.628648, exclusion.robots;dur=0.025433, exclusion.robots.policy;dur=0.011699, esindex;dur=0.011520, cdx.remote;dur=41.707654, LoadShardBlock;dur=280.058501, PetaboxLoader3.datanode;dur=133.422665, PetaboxLoader3.resolve;dur=117.158212
x-app-server: wwwb-app216
x-ts: 302
x-tr: 361
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
set-cookie: SERVER=wwwb-app216; path=/
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
HTTP/2 200
server: nginx
date: Thu, 31 Jul 2025 06:20:40 GMT
content-type: text/html;charset=utf-8
x-archive-orig-date: Sat, 08 Dec 2007 11:21:01 GMT
x-archive-orig-server: Apache/2.0.54 (Debian GNU/Linux) mod_fastcgi/2.4.2
x-archive-orig-connection: close
x-archive-guessed-content-type: text/html
x-archive-guessed-charset: utf-8
memento-datetime: Sat, 08 Dec 2007 11:21:01 GMT
link: ; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate", ; rel="first memento"; datetime="Sat, 08 Dec 2007 11:21:01 GMT", ; rel="memento"; datetime="Sat, 08 Dec 2007 11:21:01 GMT", ; rel="next memento"; datetime="Fri, 12 Aug 2011 07:53:49 GMT", ; rel="last memento"; datetime="Sat, 20 Jul 2024 22:48:35 GMT"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: 52_1_20071208104348_crawl102-c/52_1_20071208111642_crawl107.arc.gz
server-timing: captures_list;dur=0.451421, exclusion.robots;dur=0.019439, exclusion.robots.policy;dur=0.009764, esindex;dur=0.011813, cdx.remote;dur=20.300480, LoadShardBlock;dur=391.889974, PetaboxLoader3.datanode;dur=215.974176, PetaboxLoader3.resolve;dur=254.571784, load_resource;dur=176.735722
x-app-server: wwwb-app216
x-ts: 200
x-tr: 644
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
content-encoding: gzip
LearnPython - PythonInfo Wiki
LearnPython
Learning python by example
Python XML & XSLT
Create and add elements
from xml.dom.minidom import parseString
creating new document, and root element at the same time.
doc = parseString(u'<top/>'.encode('UTF-8'))
print doc.toprettyxml() will show you how it looks
this would create:
<?xml version="1.0" ?> <top/>
Now we reference to our <top/> element by:
top_element=doc.documentElement
We create another element by:
element1=doc.createElementNS(None,u'section1')
Add it under our top element by:
top_element.appendChild(element1)
Create another element and add it under element1
element1.appendChild(doc.createElementNS(None,u'subsection1'))
How to create a text node:
text1=doc.createTextNode(u'My first text')
Since we have no reference to subsection1. We start at reference to element1
element1.firstChild.appendChild(text1)
add second subelement:
element1.appendChild(doc.createElementNS(None,u'subsection2'))
create next text element, and add it to subsection2
text2=doc.createTextNode(u'My second text') element1.lastChild.appendChild(text2)
We are working with references. To switch text in subsections, you could do:
element1.firstChild.appendChild(text2) element1.lastChild.appendChild(text1)
EditText (last edited 2007-04-25 02:57:15 by LukaszSzybalski)
DeleteCache (cached 2007-11-21 17:45:51)- Login
- Navigation
- Actions
- Your recent pages