Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #71161
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'root': 0.05; 'subject:text': 0.05; 'element': 0.07; 'parser': 0.07; 'subject:into': 0.09; 'subject:parsing': 0.09; 'cc:addr:python- list': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'root:': 0.16; 'subject:XML': 0.16; 'fix': 0.17; 'wrote:': 0.18; 'stefan': 0.19; '>>>': 0.22; 'import': 0.22; 'cc:addr:python.org': 0.22; 'parse': 0.24; 'looks': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'xml': 0.29; 'message-id:@mail.gmail.com': 0.30; 'work:': 0.31; 'this.': 0.32; 'fri,': 0.33; 'something': 0.35; 'received:google.com': 0.35; 'should': 0.36; 'pm,': 0.38; 'skip:p 20': 0.39; 'easy': 0.60; 'new': 0.61; 'to:none': 0.92 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=C/h3YpfpeUTiL5mXLyUjA5Uqaja2Rl2P5vNF06WFRLQ=; b=OLwmnXKcnGd/arbPRofO2ES8JHjnoq0/LfjojGNFSxC+XEImWij5tQDMOE45Sw305C XUQt/yMOSyDM4oEnE6vpuLn/m0QETXb9rHmWQe15VNAI1kZrcSOQtSZmYrAvUQ5we/fQ 0XhR/g9IgrxLxpB8n4tQQUJEzFlYIFe0JMG+VOjR4TGoN5DK1QOjXY3/xL/BhDJqliuD pzV1NHaloXxSJRRmyivKbAcQ7bwoRIn3xcTW86vyj1rmu7gM0CROTUms5ln6mkWWJ5nr bFRklTWQBp/rfkUUELh4+u9xBV4fXCMRvrPO/3gAu2P/BlmdKNNLR8Fr3bgEvnhvd7kv ojAQ== |
| MIME-Version | 1.0 |
| X-Received | by 10.52.166.102 with SMTP id zf6mr6319243vdb.2.1399626949862; Fri, 09 May 2014 02:15:49 -0700 (PDT) |
| In-Reply-To | <lki68h$vh6$1@ger.gmane.org> |
| References | <0e5e9a24-3663-4293-a530-239486cf28fc@googlegroups.com> <CAPTjJmqd7wuy1+eAG9a+vpt-dUP-9ZzvcO50azUZ1rxAb1xN8A@mail.gmail.com> <lki68h$vh6$1@ger.gmane.org> |
| Date | Fri, 9 May 2014 19:15:49 +1000 |
| Subject | Re: parsing multiple root element XML into text |
| From | Chris Angelico <rosuav@gmail.com> |
| Cc | "python-list@python.org" <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| 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.9817.1399626951.18130.python-list@python.org> (permalink) |
| Lines | 25 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1399626951 news.xs4all.nl 2866 [2001:888:2000:d::a6]:53002 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:71161 |
Show key headers only | View raw
On Fri, May 9, 2014 at 7:13 PM, Stefan Behnel <stefan_ml@behnel.de> wrote: > Chris Angelico, 09.05.2014 11:02: >> On Fri, May 9, 2014 at 6:59 PM, Percy Tambunan wrote: >>> Hai, I would like to parse this multiple root element XML >> >> Easy fix might be to wrap it in <root> and </root>, which will give >> you a new root. > > ElementTree's XMLParser() can be use efficiently for this. Something like > this should work: > > from xml.etree.ElementTree import XMLParser > > parser = XMLParser() > parser.feed(b'<root>') > parser.feed(real_input_data) > parser.feed(b'</root>') > root = parser.close() > > for subtree in root: > ... That looks good to me :) ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
parsing multiple root element XML into text Percy Tambunan <percy.tambunan@gmail.com> - 2014-05-09 01:59 -0700
Re: parsing multiple root element XML into text Marko Rauhamaa <marko@pacujo.net> - 2014-05-09 12:01 +0300
Re: parsing multiple root element XML into text Chris Angelico <rosuav@gmail.com> - 2014-05-09 19:02 +1000
Re: parsing multiple root element XML into text Percy Tambunan <percy.tambunan@gmail.com> - 2014-05-11 21:12 -0700
Re: parsing multiple root element XML into text Peter Otten <__peter__@web.de> - 2014-05-12 10:22 +0200
Re: parsing multiple root element XML into text Stefan Behnel <stefan_ml@behnel.de> - 2014-05-09 11:13 +0200
Re: parsing multiple root element XML into text Chris Angelico <rosuav@gmail.com> - 2014-05-09 19:15 +1000
Re: parsing multiple root element XML into text Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2014-05-09 11:51 +0200
Re: parsing multiple root element XML into text Marko Rauhamaa <marko@pacujo.net> - 2014-05-09 13:33 +0300
Re: parsing multiple root element XML into text Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2014-05-09 14:01 +0200
Re: parsing multiple root element XML into text Marko Rauhamaa <marko@pacujo.net> - 2014-05-09 15:31 +0300
Re: parsing multiple root element XML into text Marko Rauhamaa <marko@pacujo.net> - 2014-05-09 15:38 +0300
Re: parsing multiple root element XML into text Stefan Behnel <stefan_ml@behnel.de> - 2014-05-09 15:55 +0200
Re: parsing multiple root element XML into text Marko Rauhamaa <marko@pacujo.net> - 2014-05-09 18:29 +0300
Re: parsing multiple root element XML into text Burak Arslan <burak.arslan@arskom.com.tr> - 2014-05-09 19:52 +0300
Re: parsing multiple root element XML into text Stefan Behnel <stefan_ml@behnel.de> - 2014-05-09 21:51 +0200
Re: parsing multiple root element XML into text Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2014-05-09 17:50 +0200
Re: parsing multiple root element XML into text Marko Rauhamaa <marko@pacujo.net> - 2014-05-09 19:15 +0300
Re: parsing multiple root element XML into text Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2014-05-09 19:16 +0200
Re: parsing multiple root element XML into text Marko Rauhamaa <marko@pacujo.net> - 2014-05-09 21:04 +0300
Re: parsing multiple root element XML into text Stefan Behnel <stefan_ml@behnel.de> - 2014-05-09 21:46 +0200
csiph-web