Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'attribute': 0.07; 'element': 0.07; 'subject: -- ': 0.07; 'subject:question': 0.10; 'python': 0.11; 'doing:': 0.16; 'received:166.84': 0.16; 'received:166.84.1': 0.16; 'received:166.84.1.89': 0.16; 'received:24.136': 0.16; 'received:mailbackend.panix.com': 0.16; 'received:panix.com': 0.16; 'roy': 0.16; 'subject:skip:e 10': 0.16; 'to:name:python list': 0.16; 'received:166': 0.19; '---': 0.24; 'received:24': 0.27; 'subject:the': 0.34; 'subject:with': 0.35; 'something': 0.35; 'charset:us-ascii': 0.36; 'url:org': 0.36; 'handle': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'skip:x 10': 0.40; 'how': 0.40; 'header:Message-Id:1': 0.63; 'smith': 0.68; "'foo'": 0.84; 'email addr:panix.com': 0.84 From: Roy Smith Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Date: Wed, 18 Sep 2013 14:59:19 -0400 Subject: lxml question -- creating an etree.Element attribute with ':' in the name To: Python List Mime-Version: 1.0 (Apple Message framework v1283) X-Mailer: Apple Mail (2.1283) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 15 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1379530769 news.xs4all.nl 15942 [2001:888:2000:d::a6]:39951 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:54392 I can create an Element with a 'foo' attribute by doing: etree.Element('my_node_name', foo=3D"spam") But, how do I handle something like: xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance", since = "xmlns:xsi" isn't a valid python identifier? --- Roy Smith roy@panix.com