[XML-SIG] Schema -> Python Objects framework?

Ian Sparks ians@etrials.com
Fri, 24 May 2002 14:03:20 -0400


Thanks Praveen, looks like xml_Objectify does some of what I want. 

Good pointer from Rich too (thank you)... I suppose SOAP serialization would
require this Python <-> XML encoding, though I was under the impression that
SOAP was an object *access* protocol rather than a way of passing python
objects themselves. I'll look into that too.

- Ian S.


-----Original Message-----
From: Praveen Kumar [mailto:pk1u@yahoo.com]
Sent: Friday, May 24, 2002 1:33 PM
To: ians@etrials.com
Cc: mertz@gnosis.cx
Subject: re: [XML-SIG] Schema -> Python Objects framework?



Ian,

I've been looking for this too. It would be nice if
the util/module also included a framework for
generating sql tables and doing the binding among xml,
python objects, and sql tables; like Castor for Java (
see http://www.castor.org/ ). 

Something you might find useful is xml_objectify; see

http://www-106.ibm.com/developerworks/xml/library/xml-matters2/index.html?dw
zone=xml

I know that the author, David Mertz ( mertz@gnosis.cx
), is working on these problems; I'm a bit too swamped
atm to work on it, but if you're interested, maybe the
two of you can coordinate work on these problems.
Regards,

Praveen

-----

From: Ian Sparks <ians@etrials.com>
To: xml-sig@python.org
Date: Fri, 24 May 2002 09:06:29 -0400
Subject: [XML-SIG] Schema -> Python Objects framework?


I have on occasion found myself writing python classes
with the ability 
to
read and write themselves to XML :

class x:
    def toxml(self):
        return '<x att1="%s" att2="%s"/>' %
(xmlencode(self.att1),xmlencode(self.att2))
    def fromxml(self,element):
        self.att1 = element.getAttribute('att1')
        ...

Sometimes this is more useful than using a DOM
directly (for instance, 
where
you want to keep memory usage low).

It occurs to me that it might be fairly easy to write
some code that 
would
take an XML Schema and convert it into skeleton python
classes with 
these
toXML() and fromXML() methods auto-generated.

This then begs the question : Has anyone done this?

- Ian Sparks.


__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com