Added code to select all text before running xmllint, then clear selection and place the cursor at the start of the document.