Add XML structure enforcement for policies. Factor out of helper methods.