Menu

Generating classes in memory and runtime?

Help
2012-02-16
2013-03-06
  • Mike Stoddart

    Mike Stoddart - 2012-02-16

    Does pyxb provide the ability to create class definitions in memory, at runtime, from XSD?

    Thanks

     
  • Peter A. Bigot

    Peter A. Bigot - 2012-02-16

    Yes.  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)
    }}}

     

Log in to post a comment.