Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #54393
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <zachary.ware@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'skip:e 50': 0.05; 'attribute': 0.07; 'element': 0.07; 'subject: -- ': 0.07; 'subject:question': 0.10; 'cc:addr:python-list': 0.11; 'python': 0.11; 'cc:name:python list': 0.16; 'doing:': 0.16; 'roy': 0.16; 'subject: \n ': 0.16; 'subject:skip:e 10': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'wed,': 0.18; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'sep': 0.31; 'subject:the': 0.34; 'subject:with': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'received:google.com': 0.35; 'url:org': 0.36; 'received:209': 0.37; 'handle': 0.38; 'pm,': 0.38; 'skip:x 10': 0.40; 'how': 0.40; 'skip:* 10': 0.61; 'smith': 0.68; "'foo'": 0.84; '2013': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=lcokDKRVgj//MkcRBymoIcabBh6LbKV9xYebeOWRWM8=; b=a29u4aNvex4NLOhJcaToV9jFNQ38WhhNS9DNhQUd+fR7PQsmpzQLcxI+rylxpcqbc4 ISn40QlRErTka0G6eWtqtNFobaP3c9HGvRwRmktUJn4QE2ACqgnrV/Qd0KpjwXqB05J/ HAAzCRQpfQbF+zBoPHH9S715SmDVIskM+pQLjuN19bNEexaFB0ZKOzJEOTk4Mnom8p5Y i4Q6vJIVUbW8RoLw5TM5rqeX8rKb1iiAspaimLL6jDwKVR7VLeEjrnNrXe670c1jEx2r 1Ku2OXVbRU2W3YYmz96aSdyO2ZNquJKFz+rjJr8DLJSw3zUmLrmYcR+5WjPuD8orA6uS HlMg== |
| X-Received | by 10.204.78.8 with SMTP id i8mr22349171bkk.3.1379531273933; Wed, 18 Sep 2013 12:07:53 -0700 (PDT) |
| MIME-Version | 1.0 |
| Sender | zachary.ware@gmail.com |
| In-Reply-To | <F1EF559F-76E7-42F4-AC96-5EC0E8B6DBA1@panix.com> |
| References | <F1EF559F-76E7-42F4-AC96-5EC0E8B6DBA1@panix.com> |
| From | Zachary Ware <zachary.ware+pylist@gmail.com> |
| Date | Wed, 18 Sep 2013 14:07:33 -0500 |
| X-Google-Sender-Auth | RoLumKjwJU70iYvCOsUxU0ZDcDc |
| Subject | Re: lxml question -- creating an etree.Element attribute with ':' in the name |
| To | Roy Smith <roy@panix.com> |
| Content-Type | text/plain; charset=UTF-8 |
| Cc | Python List <python-list@python.org> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.129.1379531615.18130.python-list@python.org> (permalink) |
| Lines | 18 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1379531615 news.xs4all.nl 15962 [2001:888:2000:d::a6]:44163 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:54393 |
Show key headers only | View raw
On Wed, Sep 18, 2013 at 1:59 PM, Roy Smith <roy@panix.com> wrote:
> I can create an Element with a 'foo' attribute by doing:
>
> etree.Element('my_node_name', foo="spam")
>
> But, how do I handle something like:
>
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance", since "xmlns:xsi" isn't a valid python identifier?
>
Try this:
etree.Element('my_node_with_invalid_identifiers_name', **{'xmlns:xsi': 'spam'})
HTH,
--
Zach
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: lxml question -- creating an etree.Element attribute with ':' in the name Zachary Ware <zachary.ware+pylist@gmail.com> - 2013-09-18 14:07 -0500
csiph-web