XML parser: moved the tag deletion outside, improved comments