Сценарий InDesign CS5: как можно игнорировать DTD при импорте XML?



Я импортирую XML в InDesign и получаю следующее сообщение:

The external entity 'blahblah.dtd' cannot be found. Continue to import anyway?

И когда я продолжаю импортировать XML, я получаю это сообщение об ошибке:

Javascript Error!

Error Number: 103237 Error String: DOM transformation error: Invalid namespace.

Engine: session File: C:\blahblah\blahblah.jsx Line: 259 Source:
obj.doc.importXML(File(xmlDoc) );

... проблема в том, что у меня нет доступа к DTD, и он мне в любом случае не понадобится.

So, is there a Extendscript way to ignore the DTD? If not, is there a way to ignore the DTD with XSLT?


Вот соответствующий код:

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

... это основано на с. 407 (глава 18)Автоматизация InDesign CS5 с использованием XML & amp; JavascriptГрант Гэмбл

Ответы на вопрос(3)

Ваш ответ на вопрос