Fixed the streaming xml writer

See https://bugs.launchpad.net/oq-nrmllib/+bug/1227605 (breakage in Python 2.7.5)
This pull requests also fixes https://bugs.launchpad.net/oq-nrmllib/+bug/1227960 (assert_xml_equal broken by newer versions of lxml).