Hi,
I need to store many XML file as document on nuxeo, but when i import these file using drag n drop, the nuxeo convert this as a Note.
Anyone have a solution for this?
To make sure that your plugin overrides the original extension you have to provide the tag inside your plugin to make sure the components load in the right order.
Here is a working example of such an override.
org.nuxeo.ecm.platform.filemanager.service.FileManagerService.Plugins text/plain text/html text/x-web-markdown
Save it in a file -config.xml and place it in the following directory: <NUXEO_HOME>/nxserver/config and restart your server.
A note on the Content-Type
It is also worth to note that your xml files have to be valid xml with a correct xml version declaration ( ) so that they can be recognized as being of the correct MIME type: text/xml. Otherwise they could be recognized as text/plain, in spite of the file name extension, and then again processed as notes in spite of your valid override definition.
What happens when a file is uploaded (creating a Note, a Picture, a File or a custom type) is configured through the FileManager component, based on the mime type of the uploaded file. See http://explorer.nuxeo.org/nuxeo/site/distribution/current/viewContribution/org.nuxeo.ecm.platform.filemanager.service.FileManagerService.Plugins--plugins
in 5.4.2 (I believe this has been changed in 5.5) the default behavior for xml mile-type file is indeed to create Note, because of the following native contribution:
<extension point="plugins" target="org.nuxeo.ecm.platform.filemanager.service.FileManagerService"> <plugin class="org.nuxeo.ecm.platform.filemanager.service.extension.NoteImporter" name="NoteImporter" order="10"> <filter>text/plain</filter> <filter>text/html</filter> <filter>application/xhtml+xml</filter> <filter>application/xml</filter> <filter>text/xml</filter> </plugin></extension>
You can override this contribution with the same name (NoteImporter) and withdraw text/xml.
Perfect!