Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #89956

Re: Is it normal to cry when given XML?

Subject Re: Is it normal to cry when given XML?
From Adam Tauno Williams <awilliam@whitemice.org>
Date 2015-05-05 06:20 -0400
References <d429abb8-2b17-4235-9eea-27a9a6f1ec9f@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.122.1430822460.12865.python-list@python.org> (permalink)

Show all headers | View raw


On Tue, 2015-05-05 at 02:28 -0700, Sayth Renshaw wrote:
> Just checking if the reaction to cry when given XML is normal. 

No, not at all.  I leap for ecstatic joy when given, as all to rarely
happens, XML.  Rather than someone's turdy text [which includes JSON]
file.  I wish all 1,200+ of my vendors and suppliers would provide their
data in XML rather than the random swirl of bizarre crap I receive.

> I thought maybe I am approaching it all wrong, using lxml largely or 
> some xquery to club it into submission. 

I do most of my processing with LXML, XSLT, and XPath.  Fast, efficient,
reliable, works great.  And it is easy to abstract these tools to
automate what I need to do over and over again.

> See the usual goal is just to take the entire XML and push it into a
> database. 

I do a lot of pushing into an SQL database, no problem.  XSLT does 99.4%
of the work.

> See its never basic xml, 

"basic xml"? 

> usually comes from some database with a walk of tables and strange relationships.

No problem.

> Am I doing it wrong is there a simple way I am missing? 

I suspect so.  Data is easily transformed into

<ResultSet table="xyz">
  <row>
    <field1 dataType="string" isNull="false"
isPrimaryKey="true">abc</field1>
    <field2 dataType="string" isNull="true" isPrimaryKey="false"/>
    <field3 dataType="string" isNull="false"
isPrimaryKey="false">stanley</field1>
  </row>
 ...
</ResultSet>

And then that data can be processes as SQL insert/update/delete/upsert
operations while being swung around on the end of a stick while you
dance.

<https://sourceforge.net/p/coils/code/ci/default/tree/coils/logic/workflow/actions/sql/upsert.py>

XML is the ultimate file "format".  It solves problems, much better than
everyone trying to re-engineer their needs INTO a format [like JSON].





-- 
Adam Tauno Williams <mailto:awilliam@whitemice.org> GPG D95ED383
Systems Administrator, Python Developer, LPI / NCLA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Is it normal to cry when given XML? Sayth Renshaw <flebber.crue@gmail.com> - 2015-05-05 02:28 -0700
  Re: Is it normal to cry when given XML? Chris Angelico <rosuav@gmail.com> - 2015-05-05 19:44 +1000
  Re: Is it normal to cry when given XML? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-05 20:04 +1000
  Re: Is it normal to cry when given XML? Adam Tauno Williams <awilliam@whitemice.org> - 2015-05-05 06:20 -0400
    Re: Is it normal to cry when given XML? Sayth Renshaw <flebber.crue@gmail.com> - 2015-05-05 05:03 -0700
  Re: Is it normal to cry when given XML? Tim <jtim.arnold@gmail.com> - 2015-05-05 06:05 -0700
  Re: Is it normal to cry when given XML? Michael Torrie <torriem@gmail.com> - 2015-05-05 10:54 -0600
  Re: Is it normal to cry when given XML? Grant Edwards <invalid@invalid.invalid> - 2015-05-05 16:58 +0000
    Re: Is it normal to cry when given XML? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-05-05 21:03 -0400
  Re: Is it normal to cry when given XML? Emile van Sebille <emile@fenx.com> - 2015-05-05 16:04 -0700
  Re: Is it normal to cry when given XML? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-05-06 00:35 +0100
  Re: Is it normal to cry when given XML? Chris Angelico <rosuav@gmail.com> - 2015-05-06 10:07 +1000
    Re: Is it normal to cry when given XML? Rustom Mody <rustompmody@gmail.com> - 2015-05-05 17:19 -0700
      Re: Is it normal to cry when given XML? Chris Angelico <rosuav@gmail.com> - 2015-05-06 10:29 +1000

csiph-web