Use XML serializer to generate proper XML

Do not cook up XML by hand when proper methods exist.