moved xml result write code to constraint handler.