XML generation revised