Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #75352
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <glicerinu@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.090 |
| X-Spam-Evidence | '*H*': 0.82; '*S*': 0.00; '8bit%:30': 0.09; 'attributes': 0.09; 'trying': 0.19; '>>>': 0.22; 'import': 0.22; 'print': 0.22; '>>>': 0.24; 'skip:e 30': 0.24; "i've": 0.25; 'skip:" 40': 0.26; 'tried': 0.27; 'idea': 0.28; 'xml': 0.29; 'skip:& 60': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; "skip:' 10": 0.31; '"",': 0.31; 'doc': 0.31; 'marc': 0.31; 'received:google.com': 0.35; 'doing': 0.36; 'hi,': 0.36; 'url:org': 0.36; 'skip:& 10': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'desperately': 0.84; 'skip:) 10': 0.84; 'xmlns:xsi': 0.84; 'imagine': 0.93 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=5ENf9bZS2YZRDB8+5vvknIrv+FoXT1cBc5VS36NWyg4=; b=kUxIPWRuz96l+3ZmBtM6v+40CI/mQX8/wTzTano/wd27j4mTY7e7x4sSngySs9GGMM N+l95T7q6Upqdz0pULLMt665w2dpsiwnfFX0NkfprRHNSG1XDf4eMnDh0XBxK2ihVSpW +KYZOV8taO5ArRwf2Cc2pINVatoL66F1J7lMvgLg6YIe+hap0YLgHBt/Qt368sy3AnlK u9SP5r+rcEkos0chZLp3ONgexKVyr7TPXvyAFI+Y61UHFUMojeH8cf8jwr2resmYVLOw CNn70A65rrndRv+/uABmGU50ffqFWMz0vgiXj590dAcYOqbgAge95rqY+mFAmDLl3FYD l04w== |
| X-Received | by 10.112.166.139 with SMTP id zg11mr4061671lbb.62.1406657977188; Tue, 29 Jul 2014 11:19:37 -0700 (PDT) |
| MIME-Version | 1.0 |
| From | Marc Aymerich <glicerinu@gmail.com> |
| Date | Tue, 29 Jul 2014 20:19:17 +0200 |
| Subject | lxml and namespaces |
| To | "comp.lang.python" <python-list@python.org> |
| Content-Type | multipart/alternative; boundary=001a113395bc0d073e04ff59157b |
| 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.12419.1406657979.18130.python-list@python.org> (permalink) |
| Lines | 74 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1406657979 news.xs4all.nl 2947 [2001:888:2000:d::a6]:48502 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:75352 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
Hi, I'm desperately trying to construct an XML with the following document
declaration:
<Document xmlns=”urn:iso:std:iso:20022:tech:xsd:pain.008.001.02”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”>
I'm using LXML, and what I'm doing is this
>>> from lxml import etree
>>> from lxml.builder import E
>>> doc = E.Document(
... {
... 'xmlns': "urn:iso:std:iso:20022:tech:xsd:pain.008.001.02",
... '{xmlns}xsi': "http://www.w3.org/2001/XMLSchema-instance",
... }
... )
>>> print etree.tostring(doc)
<Document xmlns:ns0="xmlns" ns0:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02"/>
I've tried everything I can imagine and this is the best I can do :(
Any idea on how to get the xmlns and xmlns:xsi attributes correctly?
Thanks!!
--
Marc
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
lxml and namespaces Marc Aymerich <glicerinu@gmail.com> - 2014-07-29 20:19 +0200
csiph-web