xtml parsing and rewriting