improved filenameFilter to not wrap beginning of documente (preceeding the <html> or <xml> tag)