This is a valid concern, and I have thought about it many times.  This is a tricky subject because ElementPath module is "broken", and not fixed until python 2.7/3 which we will not see for a long time.  Also, what is "legal" at this level in creating XML is hard to define.  Really the only practical way is through <code>virt-xml-validate</code>.  If XML is wrong because of a test, and nobody tried to validate, something else will hopefully break and test will Fail anyway.  I think this is the best we can do without writing our own schema validator :S