DOM as a flat dictionary

Christopher Boomer (don't dash!) c-b-o-o-m-e-r at tiscali.co.uk
Fri Jul 25 15:38:29 CEST 2003


Until now I have been using XSLT to translate from a known foreign XML
format to a local XML format for import to Postgres.  Now I need to be able
to let others define the relationship from new foreign documents using a
gui.

My thought was to generate a flat dictionary representation of the foreign
and local formats with the absolute Xpath expression as dictionary key.  The
user is presented with a list of elements&attributes in the local file and
asked to select the foreign element|attribute fills that role.  I could then
use the keys from this mapping to generate XSLT which can be stored.

Using dictionary keys means that duplicate elements will be lost, but this
is not problematic since I am attempting to map the structure not the
content.  What are the other implications of this approach?  Or is there an
easier way to do what that I cannot find in Google?

And has anyone written such a thing, even in part?

Many thanks,
Christopher Boomer
Belfast.






More information about the Python-list mailing list