Updated toxml

Updated toxml function to add the type attribute to items. Also added
the ability to set filetype and fileicon icon attributes.