I have got a structured FM file which is exported from dita topic and has exactly the same structure as of dita-topic. When I query (FrameMaker 2017 & 2019.)
IntT isXmlWellFormed = F_ApiGetInt(FV_SessionId, document_Id, FP_XmlWellFormed);
I expect to get zero but I got 2 (FV_XML_WELLFORMED_NO).
As per my understanding of the FDK documentation
* '0' means it's a FM file and
* FV_XML_WELLFORMED_YES/FV_XML_WELLFORMED_NO mean it's a xml file.
Is it a bug with FrameMaker or am I missing anything here?
Interesting question. I don't know the answer. But I did observe the following in the FDK2019 manual:
Indicates whether the source
XML qualified as well formed. Can
be one of:
I actually have no idea what any of that means. But here are some observations... it is listed as a book property, whereas you are querying a document object. Maybe it isn't relevant to a document, whatever it means.
I really can't understand the relevance of this property at all. Once a file is loaded in FM, you can't tell where it came from, whether XML, binary, or otherwise. You could look at the file extension, but that doesn't mandate anything. And, if XML is not well-formed, it can't be loaded to begin with.
What exactly did you want to accomplish by querying this property?
This is a good point that if xml is not well-formed it can't loaded. I guess we can safely assume if we get FV_XML_WELLFORMED_NO that implies it is FM document.
Do you know if we can identify document is FM document or not, instead of checking for XML? One way I can think of is hook the FA_Note_PostOpenXML and note the file type but that will be my last resort.
What I want to achieve is special processing of content based on the type of file - like inserting processing instruction tag or MarkerText.
In my experience, once a file is loaded into FrameMaker, it assumes the binary object model that is common to all documents. That is, all documents look the same once loaded.
I'm assuming that you want to know the source format, as it lives on the disk or whatever. Is the file extension unreliable? FM maintains the original extension of the file after a load. Couldn't you just look for .xml or whatever?
Your last resort doesn't seem like a bad idea to me, if all else fails.
By the way, the insertion of a PI is not really something you can do to a file that is loaded in the interface. I think you would need to do that on export with an import/export client.
I was wondering if this was related to the state of an XML document when using XML view? However that seems not to be the case, it always reports the same value of 2 (FV_XML_WELLFORMED_NO) regardless of the state of the WYSIWYG view, XML view, or the source XML.
I checked this using ExtendScript where there are equivalent XmlWellFormed properties for book and document.
I decided to go with hook the FA_Note_PostOpenXML. There is no better way.