From metolone+gmane at gmail.com Mon Dec 1 00:41:41 2008 From: metolone+gmane at gmail.com (Mark Tolonen) Date: Sun, 30 Nov 2008 15:41:41 -0800 Subject: [XML-SIG] element-value in multiple namespace References: <20081130202537.c56fec35.benkokakao@gmail.com> Message-ID: "Christian Benke" wrote in message news:20081130202537.c56fec35.benkokakao at gmail.com... > Hello! > > I'm currently struggling to extract some information from a gpx-file > (geodata in xml-format). You can see the xml-content here: > http://benko.login.cx/2008-11-21.xml > > So far i've managed to get out most of the values with this function: > > tree = etree.parse(gpxfile) > gpx_namespace = "http://www.topografix.com/GPX/1/1" > root = tree.getroot() > trackSegments = root.getiterator("{%s}trkseg"%gpx_namespace) > for trackSegment in trackSegments: > for trackPoint in trackSegment: > lat=trackPoint.attrib['lat'] > lon=trackPoint.attrib['lon'] > altitude=trackPoint.find('{%s}ele'% gpx_namespace).text > time=trackPoint.find('{%s}time'% gpx_namespace).text > > > However, i have little idea what the syntax to pick out the > values of the Temperature- and Pressure-elements has to be, which have > an additional namespace, plus they > have a "gpxx:"-prefix. I've struggled yesterday night with > this but didn't succeed. Can someone give me a kick-off how this would > work? This works with some assumptions: pressure=trackPoint.find('*/*/{http://gps.wintec.tw/xsd/}Pressure').text temp=trackPoint.find('*/*/{http://gps.wintec.tw/xsd/}Temperature').text or more precisely: pressure=trackPoint.find('{http://www.topografix.com/GPX/1/1}extensions/{http://gps.wintec.tw/xsd/}TrackPointExtension/{http://gps.wintec.tw/xsd/}Pressure').text temp=trackPoint.find(''{http://www.topografix.com/GPX/1/1}extensions/{http://gps.wintec.tw/xsd/}TrackPointExtension/{http://gps.wintec.tw/xsd/}Temperature').text Aren't namespaces fun? -Mark From martin at v.loewis.de Sun Dec 14 00:14:12 2008 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Sun, 14 Dec 2008 00:14:12 +0100 Subject: [XML-SIG] SETTING UP PYXML In-Reply-To: <36824.99179.qm@web46112.mail.sp1.yahoo.com> References: <36824.99179.qm@web46112.mail.sp1.yahoo.com> Message-ID: <494441C4.5030702@v.loewis.de> > Hello, > Please i can't install PyXml on my system...cos i dont have Visual > Studio 2003 ...please how do i use the CYGWIN-mingw PyXML is no longer maintained. You should not be using it. Regards, Martin From martin at v.loewis.de Sun Dec 14 00:15:37 2008 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Sun, 14 Dec 2008 00:15:37 +0100 Subject: [XML-SIG] can't install pyxml on windows vista In-Reply-To: References: Message-ID: <49444219.5040502@v.loewis.de> > Is anyone having issues with installing pyxml on Windows Vista SP1? > > --------------------------- > > This application has failed to start because MSVCR71.dll was not found. > Re-installing the application may fix this problem. > > > Is there a sol'n? You should install Python first, for all users. Regards, Martin From davidgshi at yahoo.co.uk Thu Dec 18 19:27:26 2008 From: davidgshi at yahoo.co.uk (David Shi) Date: Thu, 18 Dec 2008 18:27:26 +0000 (GMT) Subject: [XML-SIG] Looking for a generic efficient script for reading xml containing CDATA, extracting data for ready to be stored in a .dbf file Message-ID: <773091.70279.qm@web26301.mail.ukl.yahoo.com> Looking for a generic efficient script for reading xml containing CDATA, extracting data for ready to be stored in a .dbf file ? Can anyone help? ? Regards. ? David -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefan_ml at behnel.de Tue Dec 23 08:26:04 2008 From: stefan_ml at behnel.de (Stefan Behnel) Date: Tue, 23 Dec 2008 08:26:04 +0100 Subject: [XML-SIG] Looking for a generic efficient script for reading xml containing CDATA, extracting data for ready to be stored in a .dbf file In-Reply-To: <773091.70279.qm@web26301.mail.ukl.yahoo.com> References: <773091.70279.qm@web26301.mail.ukl.yahoo.com> Message-ID: <4950928C.8060003@behnel.de> Hi, David Shi wrote: > Looking for a generic efficient script for reading xml containing CDATA, > extracting data for ready to be stored in a .dbf file My guess is that your best bet is to do the conversion yourself in order to get the mapping right. Asking Google for "python .dbf file" gives a couple of hits, including this one: http://dbfpy.sourceforge.net/ Parsing the XML step-by-step to do the mapping on the fly should be easy using iterparse() in ElementTree or lxml. Not sure about ElementTree, but at least lxml handles CDATA sections nicely and gives you the plain text. Stefan From dvboom at hotmail.com Fri Dec 26 22:35:29 2008 From: dvboom at hotmail.com (D VanBoom) Date: Fri, 26 Dec 2008 15:35:29 -0600 Subject: [XML-SIG] python premiere language for processing XML? Message-ID: You claim to want Python to be the premier language for processing XML - but your pyxml module only supports Python 2.4? I am trying to learn Python and so far very impressed with the core language but the Python community is a disaster area. Documentation is sparse, fragmented and very poorly written. Examples are rare, and many modules are not compiled against the latest version of Python. I am writing this mostly out of frustration of a wasted afternoon trying to find a way to turn an XML string into HTML using some XSLT stylesheets I have already built and working in PHP. (It only took me 10 minutes to learn this in PHP thanks to their outstanding documentation.) I just wanted to let you know that I think your XML SIG and pyxml project appears dead and should be removed from the Python community. best regards, Don _________________________________________________________________ Send e-mail faster without improving your typing skills. http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_speed_122008 -------------- next part -------------- An HTML attachment was scrubbed... URL: From john at nmt.edu Sat Dec 27 01:48:27 2008 From: john at nmt.edu (John W. Shipman) Date: Fri, 26 Dec 2008 17:48:27 -0700 (MST) Subject: [XML-SIG] python premiere language for processing XML? In-Reply-To: References: Message-ID: On Fri, 26 Dec 2008, D VanBoom wrote: +-- | You claim to want Python to be the premier language for | processing XML - but your pyxml module only supports | Python 2.4? I am trying to learn Python and so far very | impressed with the core language but the Python community | is a disaster area. Documentation is sparse, fragmented | and very poorly written. Examples are rare, and many modules | are not compiled against the latest version of Python. +-- I have no control over this claim on the python.org site, but I can tell you that there is a much better interface, the lxml module. I've written a modest user guide that covers reading, modifying, and generating XML: http://www.nmt.edu/tcc/help/pubs/pylxml Please do not hesitate to contact me if you have any questions or comments. Best regards, John Shipman (john at nmt.edu), Applications Specialist, NM Tech Computer Center, Speare 119, Socorro, NM 87801, (505) 835-5950, http://www.nmt.edu/~john ``Let's go outside and commiserate with nature.'' --Dave Farber