45
votes

I just want to know if there is a program that can convert an XSD file to a Python class as JAXB does for Java?

3
Since Pythons dynamics means that you can set whatever attributes you want on a class, it really doesn't have field definitions in the same way, so I'm not sure it makes as much sense. But of course you could use getters and setters to make type-checks and whatnot. More interestingly though would be something that creates schema definitions for various Python schema frameworks like Zope schemas, Dexterity or SQLAlchemy. That would really be neat if that existed. - Lennart Regebro

3 Answers

40
votes

generateDS : I think this is the good tool I need

Edit : Actually, generateDS does very well the job !! It generates the Python class with all methods (setters and getters, export to XML, import from XML). It works very well !

1
votes

Look at http://pypi.python.org/pypi/rsl.xsd/0.2.3

Also, you might want http://pyxsd.org/ it works very nicely.