removed unecessary try/catch for xml_input.encode(). check if file or string, EAFP style. (thanks @turicas)