InDesign CS5 Script: ¿Cómo puedo ignorar la DTD al importar XML?
Estoy importando XML a InDesign, y recibo este mensaje:
La entidad externa 'blahblah.dtd' no se puede encontrar. ¿Seguir importando de todos modos?
Y cuando continúo importando el XML, aparece este mensaje de error:
Error de Javascript!
Número de error: 103237 Cadena de error: Error de transformación de DOM: espacio de nombres no válido.
Motor: sesión Archivo: C: \ blahblah \ blahblah.jsx Línea: 259 Fuente:
obj.doc.importXML (Archivo (xmlDoc));
... el problema es que no tendré acceso a la DTD, y no la necesitaré para mis propósitos de todos modos.
Aquí está el 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
... esto se basa en la p. 407 (capítulo 18) deInDesign CS5 Automation Usando XML y Javascript, por Grant Gamble