Hi, I've been working on updating libxml bindings with tree API. Here are some results and a few notes/questions. - libxml tree API naming convention/parameter passing is crazy, I had to implemnt [Instance(position = number)] attribute to be able to have doc.save_file_format("path") method. Patch attached. - I have found that before the second call to func, mem will not be freed: xmlstring mem; func(out mem); func(out mem); And here it will: xmlstring mem; func(out mem); mem = null; func(out mem); - There is probably reason for it, but I'll ask anyway. Why weak retvals can't be assigned to var variables? I.e. I can't do: var node = doc.new_node(); where new_node() is public weak Node new_node(); It would be excellent if "weakness" of the var was also inferred from the retval, as it is a little bit easier to write: var n = doc.new_node(); instead of: weak Node n = doc.new_node(); - libxml functions sometimes take ownership of nodes and vala zeroes the node pointer after passing it using # modifier. For example I can't write: var r = new Node(null, "root"); d.set_root_element(#r); r.new_child(...); I have to workaround it with: var _r = new Node(null, "root"); weak Node r = _r; d.set_root_element(#_r); r.new_child(...); I understand that vala can't make any assumptions about validity of the pointer after passing it to the set_root_element(). Passing ownership is passing ownership. But in case of libxml _r would be valid as long as d is valid. There are still some missing things, which I would like to do: - document parsing - xpath api I'll send normal patch when it is done, Vapi file with additions only and some test code are also attached. o.j.
Attachment:
0001-allow-to-set-exact-instnace-pointer-position.patch
Description: application/mbox
Attachment:
libxml-2.0.vapi
Description: Text document
Attachment:
test.vala
Description: Text Data