Skip to main content
Known Participant
September 1, 2014
Question

Doc Import Param to suppress XML import validation message

  • September 1, 2014
  • 1 reply
  • 414 views

Hi,

I'm running a script where the first part is to import an xml document, then to make some changes to the imported xml.

Problem is, the xml may not always be valid. If it isn't I would like to still make the changes regardless.

Unfortunately, my code is not running as I end up with "Validation of XML file failed. Continue? " prompt.

Can I somehow suppress this ?  or is there a way to send the OK key hit - so my code can just continue without requiring any user interaction ?

var importParams = GetImportDefaultParams();

                         i=GetPropIndex(importParams,Constants.FS_ImportAsType);

                        importParams.propVal.ival=Constants.FV_TYPE_XML;

                         i=GetPropIndex(importParams,Constants.FS_FileIsXmlDoc);

                        importParams.propVal.ival=Constants.FV_DoOK;

                        i=GetPropIndex(importParams,Constants.FS_AlertUserAboutFailure);

                        importParams.propVal.ival=0;

                         i=GetPropIndex(importParams,Constants.FS_DontNotifyAPIClients);

                        importParams.propVal.ival=1;

                       // var importParams = GetImportDefaultParams();

                        i=GetPropIndex(importParams,Constants.FS_HowToImport);

                        importParams.propVal.ival=Constants.FV_DoByCopy;

                        var returnParams = new PropVals() ;

                alert("importing");

                        doc.Import (doc.TextSelection.end , filename, importParams, returnParams);

             app.ActiveDoc = doc;

do_something_else();

thanks!

Tracey

This topic has been closed for replies.

1 reply

Apollo102
Inspiring
September 1, 2014

Hi,


Have you already tried to suppress the alert?

There is an example of this in the FrameMaker installation.

FM_Suppress_Alerts.jsx

ScriptsAndUtilities\Suppress Alerts

Regrads,

Apollo