Copy link to clipboard
Copied
Hey guys,
I am fairly new to the FrameMaker-scripting-thing. I basically have a folder, full of .xml files that shall be opened with a structured application and then be saved as a .fm file. I can already do that but I have to manually tell FrameMaker which structured application to use (as in How do I load an XML file, and save it as an fm file). But I can't really say which one should be used. I'd rather have the user specify the application once for the first file (maybe even open the dialog that can be seen when manually opening a .xml-file) and use it for the rest of the files as well.
Pseudo-Code:
var structApp = ChooseStructApp();
openXmlFile(filePath, structApp);
Does anyone know how to do anything like that?
Kind regards,
Tom
Copy link to clipboard
Copied
Hi Tom,
Before we get into the scripting part. Why do you need to manually tell FrameMaker which XML app to use? Is it because they all use the same Doctype, but use different schemas or DTDs?
This is the problem we get with S1000D for example. in that case it is indeed necessary to query the XML before it is opened by the relevant FrameMaker XML application.
The way I have dome that is to open the file first with ExtendScript, check the value of the xsi:noNamespaceSchemaLocation attribute, or perhaps some element in the structure that is unique to the DTD.
Ian
Copy link to clipboard
Copied
Hi Ian,
first of all: thanks for your quick reply!
Yes, they use the same Doctype but different DTDs. Okay, so your solution seems to be halfway automated (by guessing based on one value which DTD to use, instead of asking the user). That of course would be very nice as well. I'll try to see, if I can actually do that.
Thanks so much!
Tom
Copy link to clipboard
Copied
Hi Tom,
What I would do here is create a custom open function with the following features:
That's what how it works in FrameMaker's S1000D > Open S1000D command. So everything is automated - yes it's very annoying when you use the wrong XML app to open a file!
Let me know if you need any help with any of that.
Regards
Ian