Page 1 of 1

TMX files saved as binary

Posted: Fri Jun 10, 2022 7:37 pm
by domlatham
Dear Oxygen,
I am using Oxygen to connect to exist-db.
When I edit TMX files using Oxygen, which are correctly stored as xml files, they seem to be saved as binary files (mime-type application/octet-stream)
I have to reset the mime-type to for exist to recognise it as xml again.
Presumably there is some way in which I can map the file extension .tmx so it is saved as xml by exist?
Thanks for your help.
Dominic

Re: TMX files saved as binary

Posted: Tue Jun 14, 2022 6:55 am
by Radu
Hi Dominic,

I looked at the code we are using to save the resource back to the Exist server, we are using the Exist Java API we have available to set the content for a specific resource:
org.xmldb.api.base.Resource.setContent(Object)
and to store the resource back inside the parent collection:
org.xmldb.api.base.Collection.storeResource(Resource)
I do not see on our side a way to control the content type for the saved resource.
Looking at the Exist project, they seem to have a mime types XML file which has no definition for the "tmx" extension:
https://github.com/eXist-db/exist/blob/ ... -types.xml
I will try to find someone working on the Exist project to comment on this, maybe they have more ideas about how to make this work.

You can connect to an Exist server also by creating a plain Webdav connection in the Oxygen Preferences->"Data Sources" page:
https://exist-db.org/exist/apps/doc/webdav
I'm curious what happens if you open/save the file through such a webdav connection. Again also in this case we do not control the content type of the saved resource.

Regards,
Radu

Re: TMX files saved as binary

Posted: Tue Jun 14, 2022 12:17 pm
by domlatham
Dear Radu,
Thanks for taking a look.
Yes that mime-types file looks promising although I can't see it in the exist installation. How do we go about extending that?
I can confirm that the same issue happens if I save using a WebDAV connection.

With best wishes,
Dominic

Re: TMX files saved as binary

Posted: Tue Jun 14, 2022 12:28 pm
by Radu
Hi Dominic,

That mime type XML config file is saved directly inside the main Exist JAR library, I do not know if it can be set from the outside.
I asked on the Exist users list if someone who knows more about the server APIs and configuration can help further:
https://sourceforge.net/p/exist/mailman ... /37667072/
Right now from the client side we do not have control over the content type that Exist chooses to use for saving the document.

Regards,
Radu

Re: TMX files saved as binary

Posted: Tue Jun 14, 2022 12:55 pm
by domlatham
Dear Radu,

Thanks again.
In MimeTable.java mime-types.xml is first searched in
directory pointed by property "home.exist",
and then as a classpath resource in org/exist/util .
From the documentation it looks like you might be able to drop an edited copy of mime-types.xml into the exist home directory but I tried this and it didn't seem to make a difference.
Maybe the exist team will be able to shed some light.

With best wishes,
Dominic

Re: TMX files saved as binary

Posted: Tue Jun 14, 2022 1:45 pm
by Radu
Hi Dominic,

I also added an issue on the Exist issues list to consider expanding this mime types XML file with more details in a future Exist server version:
https://github.com/eXist-db/exist/issues/4443

Regards,
Radu

Re: TMX files saved as binary

Posted: Tue Jun 14, 2022 3:52 pm
by mercibe
Hi,

Adding .tmx extension at the end of the extensions element of the mime-type[@type="xml"] element and putting mime-types.xml file at the root of EXIST_HOME should do the trick.

Code: Select all

    
    <mime-type name="application/xml" type="xml">
        <description>XML document</description>        
           <extensions>
              .xml,.xsd,.rng,.mods,.xmp,.xmi,.xconf,.xmap,.xsp,.wsdl,
             .x3d,.owl,.dbx,.tei,.xces,.ead,.xqx,.xform,.gml,.fo,.nvdl,.sch,.imdi,.cmdi,
            .odd,.jcmconnect,.ditaval,.tmx
         </extensions>
    </mime-type>
You have to unzip the eXist jar and run the "exploded" version in which you have added your custom mime-types.xml at the root.

I do this on our eXist-db servers (6.0.1) and it works as expected.

Hope this will help.

Benoit