I would use QDomComment. Look at the docs. It's quite simple.