[Tutor] export postgresql to unified, templated xml

Ismar Sehic i.sheeha at gmail.com
Wed Oct 23 16:47:57 CEST 2013


Hello all.i have a quite big task, but i have a feeling it could be easily
solved using python.
The thing is, i need to export the whole company DB(Postgresql) to an XML
template provided by another company.
the template looks like this(just a fragment) :

?xml version="1.0" encoding="utf-8"?>
<PropertyDetailsRS>
  <Hotel>
    <AgencyId />
    <AgencyCode />
    <GiataCode />
    <Name />
    <Descriptions>
      <Description Lang="DE">
        <Common />
        <ShortDescription />
        <LongDescription />
        <Miscellaneous />
        <Location />
        <Interieur />
        <ImportantRemark />
      </Description>
    </Descriptions>
    <Category />
    <Country />
    <Region />
    <City />
    <Zip />
    <Address />
    <AdditionalAddress />
    <Telephone />
    <Fax />
    <Email />
    <Url />
    <DestinationAirports>
      <IataCode Code="BKK" />
    </DestinationAirports>
  </Hotel>
  <RoomList>
    <RoomGroup Id="" Code="" SeaView="" EN="" DE="">
      <RoomDescriptions>
        <RoomDescription Lang="">
          <Description />
        </RoomDescription>
      </RoomDescriptions>
    </RoomGroup>
  </RoomList>
  <BoardList>
    <Board Id="" Code="" EN="" DE="" />
  </BoardList>
  ...



i've never done anything like that.i'm familiar with psycopg2 module, also,
i'm familiar with xml parsing(ElementTree, lxml).
is there some way to use the provided xml as a template, then parse all the
data according to the template, what is the moyt pythonic way to do this?

Thx.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20131023/6256944b/attachment-0001.html>


More information about the Tutor mailing list