Updates xml handling

Better xml declaration detection.
Doesn't unescape characters anymore, but sets the xml param if a
declaration is present.