XML FileTypeID detection - setup

Hi all, I have some problems to manage XML files. I'm trying to analyse, in batch mode, some files but each file needs a different FileType. In Studio I've configurated the right xml file types and if I create a project manually Studio detect the correct FileTypeID.
Running my custom application code, using the Scan task, the FileTypeId Property is set up with a wrong FileType (always the default xml file type is detected).
In SDK I don't found a way to force or detect the right FileType.

Can somebody help me?

Thanks
Luca

  • Hi Luca,

    I’m not aware of any other developers having issues regarding detection of the file type. Are your settings being correctly saved?  Is your project being created via the API correctly?  Is the project template behaving correctly, i.e. can it be used manually?  The mechanism in the ProjectAutomationAPI should be the same as in Studio, so if Studio is recognizing the files the problem is not in filters.  Can you try to isolate this issue better and provide further details?

    Regards, Ian

    Ian Davies  |  Senior Product Manager | SDL | Language Technologies Division

    Paul Filkin | RWS Group

    ________________________
    Design your own training!

    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub

  • Hi Ian, I'm not sure to understand what you mean. The application I'm developing follows the sample code in SDK (Command line analyses) with some changes because I need to add more parameters and, for some kind of users I have to develope a GUI. The app, right now, runs with all the files supported but not with custom xml files (I mean with a new file definition added). As said it runs so I think that settings are right.

    Following the sample code,  I call a private function called 'AddFiles' with this code:

    project.AddFolderWithFiles(folder, recursion)

           Dim projectFiles As ProjectFile() = project.GetSourceLanguageFiles()

           Dim scan As AutomaticTask = project.RunAutomaticTask(projectFiles.GetIds(), AutomaticTaskTemplateIds.Scan)

    and then the function 'ConverFiles'

    Private Sub ConvertFiles(ByVal project As FileBasedProject)

           Dim files As ProjectFile() = project.GetSourceLanguageFiles()

           For i As Integer = 0 To project.GetSourceLanguageFiles().Length - 1

               If files(i).Role = FileRole.Translatable Then

                   Dim currentFileId As Guid() = {files(i).Id}

                   Dim convertTask As AutomaticTask = project.RunAutomaticTask(currentFileId, AutomaticTaskTemplateIds.ConvertToTranslatableFormat)

                   Dim copyTask As AutomaticTask = project.RunAutomaticTask(currentFileId, AutomaticTaskTemplateIds.CopyToTargetLanguages)

               End If

           Next

    As you can see it's all similar to SDK sample.

    I've tried to run my app for 2 files in a folder. One was mine, and the other was a standard studio xml file created by Studio analyse  (that with 'Task' like root element needs the FileTypeId XML: DITA 1.1 v 1.2.0.0).

    The problem is that my file is wrongly recognised, while the FileTypeID of the second file is correct.

    But, if I create a new project manually, when I add my xml file it is properly recognised.

  • Hi Luca,

    The Studio team are investigating this one and will get back to you.  We're not 100% whether the problem lies with what you are doing or with the ProjectAutomation API.

    Regards

    Paul

    Paul Filkin | RWS Group

    ________________________
    Design your own training!

    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub

  • Hi Luca

     

    So the problem you’re having is that you’ve modified the file type configuration somewhere in Studio, and that is not being picked up correctly by the Project Automation API. File type configuration is stored in Studio projects, and project templates. You say when you create a project in Studio the file types are correct, which suggests you have modified the file type list in the default project template. That template is located here:

     C:\Users\<username>\Documents\Studio 2011\Project Templates\Default.sdltpl

    The default template can be edited in Studio from the Tools > Options dialog, and also File > Setup > Project Templates...

    Can you confirm that the file type configuration is configured correctly in the default template?

     

    The Project Automation API can use this default template, but it depends what constructor of FileBasedProject has been used.

     

    From the docs:

    http://producthelp.sdl.com/sdk/ProjectAutomationApi/1.0/index.aspx

     

    FileBasedProject(ProjectInfo)

    Creates a new project based on the default project template set   up in SDL Trados Studio.

    FileBasedProject(ProjectInfo,   ProjectReference)

    Creates a new project based on an existing project.

    FileBasedProject(ProjectInfo,   ProjectTemplateReference)

    Creates a new project based on a project template.

     

    Using the first constructor should use the default project template. I’ve had a quick go on my machine and it does for me. If you’re using this and it’s not working, the only thing I can think of is if you’re running project automation under a different user account, so username here would be different:

     

    C:\Users\<username>\Documents\Studio 2011\Project Templates\Default.sdltpl

     

    Using the other constructors, the file type configuration will be taken from the specified project or project template, rather than the default template. So in these cases, the configuration you set up in the default template

     

    Regards,

    Michael