Help designing reading/writing a xml-fileformat
uche.ogbuji at gmail.com
uche.ogbuji at gmail.com
Tue Dec 13 18:23:30 EST 2005
Jacob Kroon wrote:
> I'm writing a block-diagram editor, and could use some tips about
> writing/reading
> diagrams to/from an xml file format. The basic layout of my code :
>
> class Diagram {
> Blocks blocks[]
> }
>
> class Block {
> int x, y
> }
>
> class Square(Block) {
> int width, height
> }
>
> class Circle(Block) {
> int radius
> }
>
> I'd like to be able to output something similar to this:
>
> <diagram>
> <square x='12' y='34' width='50' height='40'/>
> <circle x='40' y='60' radius='20/>
> </diagram>
[SNIP]
> Anyone have a good idea on how to approach this problem ?
> (I do not want to use the pickle module)
How about an XML pickle? PyXML has such a module. WDDX, also in
PyXML, is another option.
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.net http://fourthought.com
http://copia.ogbuji.net http://4Suite.org
Articles: http://uche.ogbuji.net/tech/publications/
More information about the Python-list
mailing list