Path: csiph.com!eeepc.pasdenom.info!news.pasdenom.info!news.dougwise.org!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'library': 0.06; 'dictionary': 0.07; 'dict': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'this:': 0.10; '270': 0.16; '272': 0.16; 'like?': 0.16; 'subject:XML': 0.16; 'daniel': 0.21; 'trying': 0.22; 'stefan': 0.23; 'header:In-Reply-To:1': 0.23; 'input': 0.25; 'to:addr:python-list': 0.31; "i've": 0.31; 'source': 0.31; 'header:X-Complaints-To:1': 0.32; 'convert': 0.33; 'file': 0.34; 'there': 0.34; 'header:User-Agent:1': 0.34; 'received:org': 0.35; 'received:de': 0.37; 'skip:t 20': 0.38; 'xml': 0.39; 'subject:: ': 0.39; 'header:Mime-Version:1': 0.39; 'to:addr:python.org': 0.40; 'skip:1 10': 0.61; 'received:188': 0.66; 'skip:2 20': 0.67; 'skip:1 20': 0.72 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Stefan Behnel Subject: Re: XML to dict(d) Date: Mon, 31 Jan 2011 14:08:02 +0100 References: <4D46AF07.6000108@danielstender.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: ppp-188-174-40-127.dynamic.mnet-online.de User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Lightning/1.0b2 Thunderbird/3.1.7 In-Reply-To: <4D46AF07.6000108@danielstender.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 34 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1296479294 news.xs4all.nl 41117 [::ffff:82.94.164.166]:41432 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:55768 Daniel Stender, 31.01.2011 13:45: > we are trying to convert a Sanskrit dictionary which is in a "homegrown" XML format into dict(d), > the input file goes like this: > > >

200akAlikam2a-kAlikam > ind. immediately MBh. 000173 2,2 > 266

>

110akAlya2a-kAlya mfn. > unseasonable. 000174 2,2 267

>

110akAsAra1a-kAsAra m. > N._of_a_teacher BhP. 000175 2,2 > 268

>

110akiYcana1a-kiYcana > mfn. without_anything_,_utterly_destitute 2,2 > 269

> 100akiYcana1a-kiYcana type="inh">mfn. disinterested 2,2 270 > 110akiYcana1a-kiYcana > n. that_which_is_worth_nothing. 000176 2,2 > 271 >

110akiYcanatA3a-kiYcana--tA > f. > voluntary_poverty_

as_practised_by_JainajEna_ascetics

.
> 000177 2,2 272

>
> > I've found that there is the library python-dictdlib for concatenating dict dictionaries, what would > be the best way to "de-XML" the source file? How do you want to the dict to look like? Stefan