better format xml function