7

I need to serialize my Python objects into XML data. I tried to use Django, but it only works for QuerySet objects and not for any simple Python object.

How can I serialize a Python object into XML data?

1

2 Answers 2

3

http://freshmeat.net/projects/gnosisxml/

Sign up to request clarification or add additional context in comments.

4 Comments

Thanks you very much, By noticed it serialize Python based objects (list , int ...) When I give it my custom objects it doesn't serialize it. Any help Thanks...
Hi , Thanks , it now works perfectly. But , I see that the dumps output many attributes I don't really want or don't want to return them to the client to save traffic , like id , module, familly and type. Do you know a way to drop them. Thanks...
This answer should include more details, as it is currently a link-only answer.
For any recent readers, gnosis is long out of date. I couldn't even install it without messing with its setup.py, and then it failed to parse certain things, looking for object properties that no longer exist in the language
3

You could also have a look at the objectify module from lxml.

2 Comments

I haven't actual used the lxml.objectify, but I do prefer lxml for straight xml processing. Very good library.
This should include usage examples.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.