InDesign CS5 Script: Como posso ignorar o DTD ao importar XML?
Estou importando XML para o InDesign e recebo esta mensagem:
A entidade externa 'blahblah.dtd' não pode ser encontrada. Continuar a importar mesmo assim?
E quando continuo a importar o XML, recebo esta mensagem de erro:
Erro de Javascript!
Número do erro: 103237 Cadeia de erro: erro de transformação DOM: espaço de nomes inválido.
Engine: session Arquivo: C: \ blahblah \ blahblah.jsx Linha: 259 Fonte:
obj.doc.importXML (File (xmlDoc));
... o problema é que eu não terei acesso ao DTD e não precisarei dele para meus propósitos.
Aqui está o código relevante:
function importXML(xmlDoc, xslt)
{
with(obj.doc.xmlImportPreferences)
{
importStyle = XMLImportStyles.MERGE_IMPORT; // merges XML elements into the InDesign document, merging with whatever matching content
createLinkToXML = true; // link elements to the XML source, instead of embedding the XML
// defining the XSL transformation settings here
allowTransform = true; // allows XSL transformation
transformFilename = File(xslt); // applying the XSL here
repeatTextElements = true; // repeating text elements inherit the formatting applied to placeholder text, **only when import style is merge!
ignoreWhitespace = true; // gets rid of whitespace-only text-nodes, and NOT whitespace in Strings
ignoreComments = true;
ignoreUnmatchedIncoming = true; // ignores elements that do not match the existing structure, **only when import style is merge!
importCALSTables = true; // imports CALS tables as InDesign tables
importTextIntoTables = true; // imports text into tables if tags match placeholder tables and their cells, **only when import style is merge!
importToSelected = false; // import the XML at the root element
removeUnmatchedExisting = false;
}
obj.doc.importXML(File(xmlDoc) );
obj.doc.mapXMLTagsToStyles(); // automatically match all tags to styles by name (after XSL transformation)
alert("The XML file " + xmlDoc.name + " has been successfully imported!");
} // end of function importXML
... isso é baseado em p. 407 (capítulo 18) deAutomação do InDesign CS5 usando XML e Javascript, por Grant Gamble