InDesign CS5 Script: Jak mogę zignorować DTD podczas importowania XML?



Importuję XML do InDesign i otrzymuję następujący komunikat:

Nie można znaleźć encji zewnętrznej „blahblah.dtd”. Czy mimo to nadal importujesz?

A kiedy kontynuuję importowanie XML, otrzymuję ten komunikat o błędzie:

Błąd Javascript!

Numer błędu: 103237 String błędu: błąd transformacji DOM: nieprawidłowa przestrzeń nazw.

Silnik: sesja Plik: C: blablah blablah.jsx Linia: 259 Źródło:
obj.doc.importXML (File (xmlDoc));

... problem polega na tym, że nie będę miał dostępu do DTD i nie będę go potrzebował do moich celów.

Czy istnieje sposób na Extendscript, aby zignorować DTD?Jeśli nie, czy istnieje sposób na zignorowanie DTD za pomocą XSLT?


Oto odpowiedni kod:

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

... to jest oparte na p. 407 (rozdział 18) zInDesign CS5 Automation Korzystanie z XML i Javascript, Grant Gamble

questionAnswers(3)

yourAnswerToTheQuestion