Added create directory if it doesn't xist to file creation.
Added xml tag checking to filename.