I am importing XML into InDesign, and I get this message:
The external entity \'blahblah.dtd\' cannot be found. Continue to import anyw
Ok, even simplier. We just have to prevent interaction and then remove any dtds attached:
function silentXMLImport(file)
{
var doc, oldInteractionPrefs = app.scriptPreferences.userInteractionLevel;
if ( !(file instanceof File) || !file.exists )
{
alert("Problem with file : "+file );
}
if ( app.documents.length == 0 )
{
alert("Open a document first");
return;
}
//Prevent interaction and warnings
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
doc = app.activeDocument;
doc.importXML ( file );
//Remove any dtd attached to the document
doc.dtds.everyItem().remove();
app.scriptPreferences.userInteractionLevel = oldInteractionPrefs;
}
//Now import xml
silentXMLImport ( File ( Folder.desktop+"/foobar.xml" ) );
It's working here.