xml application advice

William Purcell flyeng4 at gmail.com
Wed Jun 10 12:18:15 EDT 2009


Diez B. Roggisch wrote:
> William Purcell wrote:
> 
>> I am writing a application to calculate pressure drop for a piping
>> network.  Namely a building sprinkler system.  This will be a
>> command line program at first with the system described in xml (at
>> least that is how I think I want to do it).

> Use lxml2 and xpath. 
> 
> http://codespeak.net/lxml/
> http://codespeak.net/lxml/xpathxslt.html
> 

This looks promising.  I will start playing around with it and see
what I can come up with.  Thanks for the example.

Peter Otten wrote:
> I'd probably start with a few python classes representing the
> sprinkler
> system. The exact layout may change a few times until you have
> found one
> that makes your questions clear and the calculations as easy as
> possible.
>
> You can then add a read_model_from_file() function converting the
> xml into
> your model using ElementTree or its close relative lxml.
>
> My guess is that it'll be a lot more fun this way...

This was my initial plan, but I have never messed with xml and
didn't know if it was what I wanted.  I have messed around with
plistlib on a mac.  If I remember correctly the reader in plistlib
returns a dict so I thought I would be getting a dict from an xml
reader (but maybe xml and plist aren't as close as I thought).
Reading xml seems more complicated than I initially expected, but
probably rightfully so.

But I digress.

I will take your advice and start with some classes and then work on
getting the data to my classes.




More information about the Python-list mailing list