On Feb 14, 1:49 pm, Stefan Behnel <[EMAIL PROTECTED]> wrote: > Hi, > > [EMAIL PROTECTED] 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-f...http://codespeak.net/lxml/objectify.html#element-access-through-objec...http://codespeak.net/lxml/objectify.html#python-data-types > then maybe > this:http://codespeak.net/lxml/objectify.html#defining-additional-data-cla... > 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
I was trying to start a discussion on a cool OO design. Problem's kind of solved; downer, huh? I haven't completed it, but it's a start. I expect I'll post some thoughts along with progress. Will Excel read it? We'll see. A design difference: Worksheet= lambda parent: etree.SubElement( parent, "Worksheet" ) Table= lambda parent: etree.SubElement( parent, "Table" ) sheet= Worksheet( book ) #parent table= Table( sheet ) vs. table= Table() #empty table sheet= Worksheet( table= table ) #child I want to call sheet.table sometimes. Is there a lxml equivalent? -- http://mail.python.org/mailman/listinfo/python-list