Use smarter BOM-skipping logic when parsing XML.

github: close #154