Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2a.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.015 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'tutorial': 0.03; 'elements.': 0.07; 'attributes': 0.09; 'objects,': 0.09; 'parsing': 0.09; 'api': 0.11; 'python': 0.11; 'assigned,': 0.16; 'burak': 0.16; 'from:addr:arskom.com.tr': 0.16; 'from:addr:burak.arslan': 0.16; 'from:name:burak arslan': 0.16; 'message-id:@arskom.com.tr': 0.16; 'received:arskomhosting.com': 0.16; 'subject:Programming': 0.16; 'subject:XML': 0.16; 'elements': 0.16; 'wrote:': 0.18; 'examples': 0.20; 'header:User- Agent:1': 0.23; 'parse': 0.24; 'suggested': 0.26; 'header:In- Reply-To:1': 0.27; 'to:2**1': 0.27; 'point': 0.28; 'xml': 0.29; "i'm": 0.30; 'getting': 0.31; 'libraries': 0.31; 'file': 0.32; 'supposed': 0.32; 'regular': 0.32; 'created': 0.35; 'objects': 0.35; 'there': 0.35; 'programming,': 0.36; 'behind': 0.37; 'subject:New': 0.37; 'to:addr:python-list': 0.38; 'files': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'everybody': 0.60; 'most': 0.60; 'new': 0.61; 'here:': 0.62; 'save': 0.62; 'myself': 0.63; 'levels': 0.65; 'teach': 0.65; 'charset:windows-1252': 0.65; 'computers.': 0.84; 'tasked': 0.84; 'terrible': 0.84; 'loves': 0.93; 'directly.': 0.95 Date: Wed, 01 Apr 2015 16:44:02 +0300 From: Burak Arslan User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: catperson , python-list@python.org Subject: Re: New to Programming - XML Processing References: In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20 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: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1427895853 news.xs4all.nl 2968 [2001:888:2000:d::a6]:54098 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:88424 On 04/01/15 06:27, catperson wrote: > I am new to programming, though not new to computers. I'm looking to > teach myself Python 3 and am working my way through a tutorial. At > the point I'm at in the tutorial I am tasked with parsing out an XML > file created with a Garmin Forerunner and am just having a terrible > time getting my head around the concepts. What I'm looking for is > some suggested reading that might give me some of the theory of > operation behind ElementTree and then how to parse out specific > elements. Most of what I have been able to find in examples that I > can understand use very simplistic XML files and this Garmin file is > many levels of sub-elements and some of those elements have attributes > assigned, like . As everybody loves objects, there are many libraries that parse xml documents to regular python objects (with proper hierarchy). These are supposed to save you from dealing with ElementTree api directly. Have a look here: http://stackoverflow.com/questions/19545067/python-joining-and-writing-xm= l-etrees-trees-stored-in-a-list Hth, Burak