InDesign CS5-Skript: Wie kann ich die DTD beim Importieren von XML ignorieren?
Ich importiere XML in InDesign und erhalte die folgende Meldung:
Die externe Entität 'blahblah.dtd' kann nicht gefunden werden. Trotzdem weiter importieren?
Und wenn ich dann weiter das XML importiere, bekomme ich folgende Fehlermeldung:
Javascript Fehler!
Fehlernummer: 103237 Fehlerzeichenfolge: DOM-Umwandlungsfehler: Ungültiger Namespace.
Engine: session Datei: C: \ blahblah \ blahblah.jsx Zeile: 259 Quelle:
obj.doc.importXML (File (xmlDoc));
... das Problem ist, dass ich keinen Zugriff auf die DTD habe und sie sowieso nicht für meine Zwecke benötige.
Hier ist der relevante Code:
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
... das basiert auf p. 407 (Kapitel 18) vonInDesign CS5-Automatisierung Mit XML und Javascriptvon Grant Gamble