Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'encoding': 0.05; 'subject:text': 0.05; 'dynamically': 0.07; 'explicit': 0.07; 'json': 0.07; 'parser': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:into': 0.09; 'subject:parsing': 0.09; 'ebcdic,': 0.16; 'from:addr:behnel.de': 0.16; 'from:addr:stefan_ml': 0.16; 'from:name:stefan behnel': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:XML': 0.16; 'task.': 0.16; 'worst': 0.16; 'passing': 0.19; 'stefan': 0.19; 'header:User-Agent:1': 0.23; 'parse': 0.24; 'least': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply- To:1': 0.27; 'character': 0.29; 'xml': 0.29; "doesn't": 0.30; 'commonly': 0.31; "can't": 0.35; 'received:84': 0.35; 'there': 0.35; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'more': 0.64; 'different': 0.65; 'default': 0.69; 'discovered': 0.83; 'nonsense.': 0.84; 'received:arcor- ip.net': 0.84; 'received:pools.arcor-ip.net': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Stefan Behnel Subject: Re: parsing multiple root element XML into text Date: Fri, 09 May 2014 21:46:04 +0200 References: <0e5e9a24-3663-4293-a530-239486cf28fc@googlegroups.com> <87oaz7uvo4.fsf@dpt-info.u-strasbg.fr> <87a9arfdha.fsf@elektro.pacujo.net> <87k39vupnc.fsf@dpt-info.u-strasbg.fr> <8738gjf813.fsf@elektro.pacujo.net> <87fvkjuf2c.fsf@dpt-info.u-strasbg.fr> <87lhubdj2j.fsf@elektro.pacujo.net> <87bnv6vpn0.fsf@dpt-info.u-strasbg.fr> <87bnv6de1j.fsf@elektro.pacujo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: dslb-084-056-010-059.pools.arcor-ip.net User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 In-Reply-To: <87bnv6de1j.fsf@elektro.pacujo.net> 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: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1399664787 news.xs4all.nl 2866 [2001:888:2000:d::a6]:43199 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:71184 Marko Rauhamaa, 09.05.2014 20:04: > I think the worst part of XML is that you can't parse it without a DTD > or schema. Nonsense. > I was very hopeful about json until I discovered they require the parser > to dynamically support five different character encodings. > > XML at least standardized on UTF-8. Not really. Definitely not "standardized". It's just the default if there is no explicit encoding or BOM. That doesn't keep you from passing around XML in EBCDIC, if you feel like it. > I have found ast.literal_eval() to be highly usable. Well, there's json.loads(), which is more commonly used for this task. Stefan