You'd have to replace the generation function (which produces Python source) with something that produces what you have below. It'd be a chunk of work, but technically there's no reason it couldn't be done.
Peter On Thu, Feb 16, 2012 at 7:43 PM, Mike Stoddart <sto...@gmail.com> wrote: > Thanks. > > I see it uses eval/exec. Is there a way to not use these? Something like: > > Bar = type( > 'Bar', > (object,), > dict( > x = 10, > y = 20, > get_x=lambda self:self.x, > get_y=lambda self:self.y > ) > ) > > > > Thanks > > > On Thu, Feb 16, 2012 at 8:39 PM, Peter Bigot <big...@acm.org> wrote: >> >> Yes, you can do that. Do something like the following; see many >> examples in the tests/trac directory where this is commonly done. >> >> import pyxb.binding.generate >> code = pyxb.binding.generate.GeneratePython(schema_text=xsd) >> rv = compile(code, 'test', 'exec') >> eval(rv) >> instance = CreateFromDocument(xml) >> >> Peter >> >> On Thu, Feb 16, 2012 at 7:24 PM, Mike Stoddart <sto...@gmail.com> wrote: >> > Does pyxb let you create class definitions in memory, at runtime? The >> > docs >> > imply that the classes can only be generated into source files at the >> > command line. So I just wanted to check. :) >> > >> > Thanks >> > >> > >> > ------------------------------------------------------------------------------ >> > Virtualization & Cloud Management Using Capacity Planning >> > Cloud computing makes use of virtualization - but cloud computing >> > also focuses on allowing computing to be delivered as a service. >> > http://www.accelacomm.com/jaw/sfnl/114/51521223/ >> > _______________________________________________ >> > pyxb-users mailing list >> > pyxb-users@lists.sourceforge.net >> > https://lists.sourceforge.net/lists/listinfo/pyxb-users >> > > > > > ------------------------------------------------------------------------------ > Virtualization & Cloud Management Using Capacity Planning > Cloud computing makes use of virtualization - but cloud computing > also focuses on allowing computing to be delivered as a service. > http://www.accelacomm.com/jaw/sfnl/114/51521223/ > _______________________________________________ > pyxb-users mailing list > pyxb-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/pyxb-users > ------------------------------------------------------------------------------ Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ _______________________________________________ pyxb-users mailing list pyxb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyxb-users