Adds "wrap" utility method.
Minor code cleanup.
Hack to handle empty encoding attrbute in XML header.