Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Marko Rauhamaa Newsgroups: comp.lang.python Subject: Re: parsing multiple root element XML into text Date: Fri, 09 May 2014 21:04:24 +0300 Organization: A noiseless patient Spider Lines: 29 Message-ID: <87bnv6de1j.fsf@elektro.pacujo.net> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx05.eternal-september.org; posting-host="ff5cf27ef3d5b31f034d3b72bdc27a41"; logging-data="14665"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19JhWTxxjWA/Y5ehkbNzh4e" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) Cancel-Lock: sha1:xjumT2w/opTIwcOXdP3RIXlP+Qo= sha1:D2TDw3kdrFqJZaJMXT2cszczOZQ= Xref: csiph.com comp.lang.python:71183 Alain Ketterlin : > How do you specify the encoding of sexprs? How can you require that an > attribute value must match the value of an id-attribute? or whatever > insanely complex integrity rule that XML Schemas lets you express? And > so on. I don't suppose there is a universal schema language available for S expressions, nor do I suppose many people want such a thing. You specify S expression encoding the way you specify Python library functions. I think the worst part of XML is that you can't parse it without a DTD or schema. > If all you need to do is parse properly bracketed input, go with > sexprs, or json, or yaml, or pickle if both ends are python programs. 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. I have found ast.literal_eval() to be highly usable. Pickle I would advise you to stay away from: . Marko