XML pickle

Stefan Behnel stefan_ml at behnel.de
Thu Feb 14 14:49:18 EST 2008


Hi,

castironpi at gmail.com wrote:
> Stefan Behnel wrote:
>> What I meant was: please state what you are trying to do. What you describe
>> are the environmental conditions and possible solutions that you are
>> thinking of, but it doesn't tell me what problem you are actually trying
>> to solve.

http://catb.org/~esr/faqs/smart-questions.html#goal

> What problem -am- I trying to solve?  Map the structure -in- to XML.

http://catb.org/~esr/faqs/smart-questions.html#beprecise

Is it a fixed structure you have, or are you free to use whatever you like?


> Objects first.  Create.

http://catb.org/~esr/faqs/smart-questions.html#writewell

My guess is that this is supposed to mean: "I want to create Python objects
and then write their structure out as XML". Is that the right translation?

There are many ways to do so, one is to follow these steps:

http://codespeak.net/lxml/objectify.html#tree-generation-with-the-e-factory
http://codespeak.net/lxml/objectify.html#element-access-through-object-attributes
http://codespeak.net/lxml/objectify.html#python-data-types
then maybe this:
http://codespeak.net/lxml/objectify.html#defining-additional-data-classes
and finally this:
http://codespeak.net/lxml/tutorial.html#serialisation

But as I do not know enough about the problem you are trying to solve, except:

> The use case is a simulated strategy tournament.

I cannot tell if the above approach will solve your problem or not.

Stefan



More information about the Python-list mailing list