SQL recordset -> XML

Jegenye 2001 Bt jegenye2001 at fw.hu
Mon Oct 27 18:27:13 EST 2003


Once I saw something like this...
Sorry can't remember where and when..

They advocated a very simple shallow representation like this:
<row><field1>data</field1>etc..</row>
and there was even an acronym for that. :)


Best,
 Miklós

--
PRISZNYÁK  Miklós
---
Jegenye 2001 Bt. ( mailto:jegenye2001 at parkhosting.com )
Egyedi szoftverkészítés, tanácsadás
Custom software development, consulting
http://jegenye2001.parkhosting.com


Richard Shea <richardshea at fastmail.fm> wrote in message
news:282f826a.0310271500.62fe7a5a at posting.google.com...
> Hi - Not sure if this is a really stupid question or not ... so I
> thought I'd ask it anyway ;-)
>
> I want to take data from a SQL generated recordset and represent it as
> XML.
>
> I can think of *very* straightforward ways (as I'm sure all you can)
> to do that (please excuse rough/weird pseudo code) ...
>
> if you had a recordset resulting from a query something like :
>
> select
> Suburb_Value,City_Value
> from
> Table_Locations
> ORDER BY CITY_VALUE,SUBURB_VALUE
>
> ... and you then did something like this (only a lot tidier) ...
>
> do while no_more_records
>     if Suburb_Value <> CurrentSuburb
>         output Closing_City_Tag
>         output Opening_City_Tag(City_Value)
>     end if
>     output Opening_Suburb_Tag
>     output Suburb_Value
>     output Closing_Suburb_Tag
> end do
>
> ... you'd get what I'm after but it's all a bit clunky and of course
> very specific the current recordset.
>
> I just wondered if anyone had written anything to at least help this
> process a bit ?
>
> I'm in the process of reading the O'Reilly "XML and Python" book and
> there's any amount of support for 'input XML' but nothing really to
> assist with output.
>
> Is there a smart way to do this ?
>
> thanks
>
> richard shea.






More information about the Python-list mailing list