use __gc to collecte memory to be allocated by libxml2

* and tests rearranged