Daniel is a web developer, system programmer and software architect with 12 years of experience...
web developer & system programmer
coder . cl
here you can find daniel's articles on programming, software development and ramblings on his current projects...
incomming changes for pyxser-1.4
by Daniel Molina Wegener on 22.12.2009pyxser, my Python-Object to XML serializer is suffering few changes, but important ones. The main change is the fact that I will add a type map optional parameter for deserialization functions. How should it work?
def create_string_from_string(mystr, myroot):
return str(mystr)
my_typemap = {'java.lang.String': create_string_from_string,
'String': create_string_from_string,
'string': create_string_from_string}
unserialized = pyxser.unserialize(obj = serialized, \
enc = "utf-8", \
typemap = my_typemap)
This will allow you to create the proper instance of non standard objects in Python. For example if there exists a third party class which needs a special instantation, like the ones which are using sockets or files, this will allow you to create the instance with a custom function, specially if the serialized object comes from other languages.
The type map callbacks will be called using my_typemap['maptype'](python_string, root_object), where python_string is the node content as Python String and root_object is the deserialized root object — the pointed by the root element. About the error occurrences, I will clear each error produced inside the type map function, by call PyErr_Clear(), then you must control those errors produced inside your callback, and return Py_None (None) on each one.
I will be writing this feature this week and the weekend, if you want a change over this feature, this is the time to get some feedback. I think that pyxser-1.4r will be launched on 2010-01-01.
One Response to “incomming changes for pyxser-1.4”
Leave a Reply
You need to log in to vote
The blog owner requires users to be logged in to be able to vote for this post.
Alternatively, if you do not have an account yet you can create one here.
Powered by Vote It Up


[...] you have seen in my last post, I’ve been working on some strong changes on pyxser. Today I’ve released pyxser-1.4r and the announcement [...]