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


Groups > comp.lang.python > #2577

XML header with lxml

Return-Path <jabba.laci@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.043
X-Spam-Evidence '*H*': 0.91; '*S*': 0.00; 'prints': 0.07; 'to:name:python mailing list': 0.09; 'subject:XML': 0.16; 'subject:lxml': 0.16; 'thanks,': 0.17; 'xml': 0.26; 'message- id:@mail.gmail.com': 0.28; 'hi,': 0.29; 'construct': 0.31; 'import': 0.32; 'to:addr:python-list': 0.32; 'file': 0.35; 'print': 0.35; 'received:209.85': 0.37; 'subject:with': 0.37; 'received:google.com': 0.38; 'but': 0.38; 'to:addr:python.org': 0.39; 'received:209': 0.39; 'how': 0.39; 'add': 0.39; 'header:Received:5': 0.40
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:from:date:message-id:subject:to :content-type; bh=RJYGvc0cbOl4X0vV+FteX+5bLhhhwyTajHV9TF+vDyA=; b=fk21RYbuW1pDK2dtV+txtxLhkFlrv1cX5pHYXUj3ZmWEKzRT6jZWHGFRlmuS9xkZDz YYL8us8kCJ/ACb2wbaFuF7pgOHodyfPKFRfgB4H9jO/TsgA9luSlu2JBSOyPj7YNwW4L 4wzCYuJ95mI1sJWNzDZoNOVtEuS+9cspvFoBk=
DomainKey-Signature a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=F+4MXEhYsH87dNxvlQIFiCOmoCM0e1FmLK3UxfNRacnx3BvJmfz1D1+YAkXU2zdQ9s QOHQcCuF3AJeYPvIJx88JHhE6VNePkmmnQskWqvWcDIztZG9HrHh26F6jIj5smuNpg7S cNomPbSUSyIl9w86HN4an+eT5Noi41aXC/kh8=
MIME-Version 1.0
From Jabba Laci <jabba.laci@gmail.com>
Date Mon, 4 Apr 2011 12:54:40 -0400
Subject XML header with lxml
To Python mailing list <python-list@python.org>
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.10.1301936101.9059.python-list@python.org> (permalink)
Lines 16
NNTP-Posting-Host 82.94.164.166
X-Trace 1301936102 news.xs4all.nl 65870 [::ffff:82.94.164.166]:56243
X-Complaints-To abuse@xs4all.nl
Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.stben.net!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!usenetcore.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:2577

Show key headers only | 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