rewrite xml generation