Skip to main content
Legend
June 18, 2008
Question

XML file considered "Unknown File Type"

  • June 18, 2008
  • 6 replies
  • 2427 views
Hi,

I have XML files that lack an XML declaration. Part of the import process, though, is an XSLT stylesheet that adds one through standard XSLT output (ie, omit-xml-declaration="no"). However, Frame still decides that it is an unknown file type and forces me to select "XML" in that dialog box.

When I run an XML file through the stylesheet manually (with another processor), I see the declaration added. Furthermore, the externally-transformed file imports without a hitch.

Any ideas why the declaration is not recognized when added by XSLT during the import process? More importantly, any ideas how to get around this?

Thanks,
Russ
This topic has been closed for replies.

6 replies

Russ WardAuthor
Legend
July 3, 2008
Sylvia, I used the following function, which shows the parameters for F_ApiOpen(). Note that this worked for the one problem I was having with the "unknown file type" dialog box. There are a myriad of other XML errors that can occur which you may not be able to get around.

Russ

F_ObjHandleT ws_OpenFile_IgnoreErrors_HonorLock_Visible(StringT ofFilePath)
{
F_PropValsT openScript, *returnp = NULL;
UIntT sn;
F_ObjHandleT ofDocId;

openScript = F_ApiGetOpenDefaultParams();

sn = F_ApiGetPropIndex(&openScript, FS_AlertUserAboutFailure);
openScript.val[sn].propVal.u.ival = False;

sn = F_ApiGetPropIndex(&openScript, FS_BookIsInUse);
openScript.val[sn].propVal.u.ival = FV_DoCancel;

sn = F_ApiGetPropIndex(&openScript, FS_DontNotifyAPIClients);
openScript.val[sn].propVal.u.ival = True;

sn = F_ApiGetPropIndex(&openScript, FS_FileIsInUse);
openScript.val[sn].propVal.u.ival = FV_DoCancel;

sn = F_ApiGetPropIndex(&openScript, FS_FontChangedMetric);
openScript.val[sn].propVal.u.ival = FV_DoOK;

sn = F_ApiGetPropIndex(&openScript, FS_FontChangedMetric);
openScript.val[sn].propVal.u.ival = FV_DoOK;

sn = F_ApiGetPropIndex(&openScript, FS_FontNotFoundInCatalog);
openScript.val[sn].propVal.u.ival = FV_DoOK;

sn = F_ApiGetPropIndex(&openScript, FS_FontNotFoundInDoc);
openScript.val[sn].propVal.u.ival = FV_DoOK;

sn = F_ApiGetPropIndex(&openScript, FS_LanguageNotAvailable);
openScript.val[sn].propVal.u.ival = FV_DoOK;

sn = F_ApiGetPropIndex(&openScript, FS_LockCantBeReset);
openScript.val[sn].propVal.u.ival = FV_DoOK;

sn = F_ApiGetPropIndex(&openScript, FS_MakeVisible);
openScript.val[sn].propVal.u.ival = True;

sn = F_ApiGetPropIndex(&openScript, FS_NewDoc);
openScript.val[sn].propVal.u.ival = False;

sn = F_ApiGetPropIndex(&openScript, FS_OpenBookViewOnly);
openScript.val[sn].propVal.u.ival = False;

sn = F_ApiGetPropIndex(&openScript, FS_OpenDocViewOnly);
openScript.val[sn].propVal.u.ival = False;

sn = F_ApiGetPropIndex(&openScript, FS_OpenFileNotWritable);
openScript.val[sn].propVal.u.ival = FV_DoOK;

sn = F_ApiGetPropIndex(&openScript, FS_RefFileNotFound);
openScript.val[sn].propVal.u.ival = FV_AllowAllRefFilesUnFindable;

sn = F_ApiGetPropIndex(&openScript, FS_UseAutoSaveFile);
openScript.val[sn].propVal.u.ival = FV_DoNo;

sn = F_ApiGetPropIndex(&openScript, FS_UpdateTextReferences);
openScript.val[sn].propVal.u.ival = FV_DoNo;

sn = F_ApiGetPropIndex(&openScript, FS_UpdateXRefs);
openScript.val[sn].propVal.u.ival = FV_DoNo;

sn = F_ApiGetPropIndex(&openScript, FS_UseRecoverFile);
openScript.val[sn].propVal.u.ival = FV_DoNo;

sn = F_ApiGetPropIndex(&openScript, FS_UseAutoSaveFile);
openScript.val[sn].propVal.u.ival = FV_DoNo;

//open the document
ofDocId = F_ApiOpen(ofFilePath, &openScript, &returnp);

//we are done with these structures, so deallocate
F_ApiDeallocatePropVals(&openScript);
F_ApiDeallocatePropVals(returnp);

return ofDocId;

}
Participant
July 2, 2008
Hi Russ:

How did you open the XML through the FDK (F_ApiOpen) without interruption? What params values have you set for the F_PropValsT to make the Open without interruption? Could please post some code to do that? I am trying to do that, too.

Thanks.

Sylvia
Russ WardAuthor
Legend
June 18, 2008
Ian,

I think you nailed it... this must be a cart before the horse thing. The XSLT doesn't run until I select "XML" and continue on. That makes sense. OK then, I guess I'll have to think some more.

Interestingly, when I open it through the FDK (F_ApiOpen), it opens without interruption and everything works fine. Maybe that's the easiest solution... add a menu command to open XML files this way, rather than try to manipulate the files themselves.

Thanks to all for the suggestions. I apologize for failing to mention the FM version which is 7.2.

Russ
Ian Proudfoot
Legend
June 18, 2008
Hi Russ,

Is the original XML without the XML declaration created by FrameMaker?

When FrameMaker opens a file it checks to see what type of file it is, then if it's recognized as XML it chooses the relevant XML application(s), only then can the XSLT be applied as given in the app definition. So adding the declaration at that point is already too late.

I think you would have to pre-process this file to add the XML declaration perhaps using FDK.

Ian
Known Participant
June 18, 2008
Russ,

I worked in a large corporation that used FrameMaker+SGML to create content for an online help system. The workflow was always to save the Frame file as SGML, which was then post-processed into HTML. Updating the file meant opening the SGML file, and Frame always complained that it was an unknown file type. The IT powers that be said it was just a Frame quirk.

So, when I see the same behavior with XML, I just assume it is a quirk of FrameMaker. Maybe there is a deeper reason, as Martti suggests, but I do not know what it is.

Van
Inspiring
June 18, 2008
Hi Russ,

Frame (at least 7.2) is very strict with the beginning of the xml file. Any space or line feed before the xml declaration causes the file type error. Check the xml file with ascii editor (hmm..how the get access when using import stylesheet..).

Quick tests (w/o import.xsl):

1. Instance starts directly with doctype declaration. Frame complains that there is no xml decl and proposes that it might be sgml. Opens ok anyway

2. Any space/blank line before xml decl -> unknown file type

3. Missing doctype causes frame to say "Unable to validate...." etc. but still opens the file

Hard to say why this happens, any output controls in xsl (indents etc)?, something must generate space or CR/LF before declaration

Martti