Fixed file path detection bug in build method polymorphism
(when string was recognised as path cause of  "xml", "yml", etc. content in it)
Refactored file detection duplication in few places
Fixed xml file format detection (f variable assigned but never used)
Deleted some trailing spaces in the refactored file
Merge pull request #79 from smileart/master

Fixed file path detection bug in build method polymorphism