Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #2577

XML header with lxml

From Jabba Laci <jabba.laci@gmail.com>
Date 2011-04-04 12:54 -0400
Subject XML header with lxml
Newsgroups comp.lang.python
Message-ID <mailman.10.1301936101.9059.python-list@python.org> (permalink)

Show all headers | View raw


Hi,

I want to construct an XML file with lxml but I don't find how to add
the '<?xml version="1.0"?>' header.

from lxml import etree as ET

html = ET.Element("html")
print ET.tostring(html)

simply prints
<html/>

Thanks,

Laszlo

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

XML header with lxml Jabba Laci <jabba.laci@gmail.com> - 2011-04-04 12:54 -0400
  Re: XML header with lxml Chroma Key <chroma@key.invalid> - 2011-04-04 21:49 +0200
    Re: XML header with lxml Stefan Behnel <stefan_ml@behnel.de> - 2011-04-05 10:17 +0200

csiph-web