normalize DOMDocument before validation