xml parsing and document creation