XML file format

Final Cut Pro has introduced a new format for XML imports/exports and I’m having difficulty opening and accessing the XML data. I’ve uploaded a sample XML in the new format here:

https://edittoolsspace.nyc3.digitaloceanspaces.com/Xojo/test%20XML.fcpxmld.zip

Here’s Apple’s write up on the new format:

> XML Bundle Format: Starting with DTD 1.10, Final Cut Pro will export FCPXML

using a new bundle format with the extension “.fcpxmld”. This bundle will always
contain a .fcpxml file at the root level of the bundle directory with the filename
“Info.fcpxml”. Depending on the content being exported from FCP, the bundle may
contain other files referenced by the Info.fcpxml file. However, a bundle with only the
Info.fcpxml file is also valid. If your application supports opening .fcpxml files, it is
recommended that you also support .fcpxmld bundles. DTD 1.9 exports will continue
to use a single .fcpxml file.

In the Finder’s inspector window the file’s Kind is listed as “Final Cut Pro XML Bundle”. If I select the file and show package contents there is a single XML file named Info.fcpxml just like the above text describes. If I drag it out of the enclosing file and import it into FCP or a compatible app it behaves just like previous FCP XMLs.

My problem is I can’t programmatically access the Info.fcpxml file. It’s not in a Contents or Resources folder so I can’t figure out the path in order to open it.

Any suggestions? I haven’t successfully been able to add the file format to my FileTypes panel either so my OpenDialog code doesn’t filter the new file type. Here’s a screen shot of my listing in FileTypes:

Thanks for any suggestion.

It’s at the root level not in a folder named Contents or Resources. This means it’s the immediate child of the fcpxmld.

var fTarget as FolderItem
// Ask the user for the .fcpxmld
var fInfo as FolderItem = fTarget.Child("Info.fcpxml")

###

Global FileType objects as filters has been broken forever. I showed Xojo staff members at XDC Houston in 2016. A reliable workaround is to create the FileType object in code immediately before you need to use it. For whatever reason, this works.

// Pseudo-code written in the post editor to illustrate
var ftFCPXML as new FileType
ftFCPXML.Name = "Final Cut Pro XML Bundle"
ftFCPXML.Extensions = ".fcpxmld"

var dlg as new OpenFileDialog
dlg.Filter = ftFCPXML
2 Likes

Thanks, so much, Tim. This makes perfect sense. I’ll work it into my code tonight and see how everything works.
Tony

Hi Tim,
I had a chance to try your code sample out last night and everything worked well. There are a couple caveats:

  • Your example of how to create a FolderItem for the “info.fcpxml” file worked perfectly. But when I tried to open the file while inside the bundle, Xojo returned ioError 21, which wasn’t too helpful in figuring out what went wrong. The solution was to copy the"info.fcpxml" file to the app’s Container folder. Then, opening and reading the copy worked perfectly.

  • I got the FileTypes editor to work! At least with the file picker. I removed everything in each fileType panel except the fileType name (the name used in code), its display name, and its extension. It probably won’t work for other FileType needs, but it’s helpful with setting the OpenFileDialog display to the fileTypes you want.