Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8312909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T20:19:02+00:00 2026-06-08T20:19:02+00:00

I am importing XML into InDesign, and I get this message: The external entity

  • 0

I am importing XML into InDesign, and I get this message:

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

And when I then continue to import the XML, I get this error message:

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) );

…the problem is, is that I won’t have access to the DTD, and I won’t need it for my purposes anyway.


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

Here is the relevant 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

…this is based on p. 407 (Chapter 18) of InDesign CS5 Automation Using XML & Javascript, by Grant Gamble

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T20:19:04+00:00Added an answer on June 8, 2026 at 8:19 pm

    Ok, even simplier. We just have to prevent interaction and then remove any dtds attached:

    function silentXMLImport(file)
    {
        var doc, oldInteractionPrefs = app.scriptPreferences.userInteractionLevel;
    
        if ( !(file instanceof File) || !file.exists )
        {
            alert("Problem with file : "+file );
        }
    
        if ( app.documents.length == 0 )
        { 
            alert("Open a document first");
            return; 
        }
    
        //Prevent interaction and warnings
        app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
        doc = app.activeDocument;
        doc.importXML ( file );
    
        //Remove any dtd attached to the document
        doc.dtds.everyItem().remove();
    
        app.scriptPreferences.userInteractionLevel = oldInteractionPrefs;
    }
    
    //Now import xml
    silentXMLImport ( File ( Folder.desktop+"/foobar.xml" ) );
    

    It’s working here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to import an XML file into MS Access 2003, through File>Get
I am importing an xml file of blog posts into Django. Part of this
I've been working on importing XML into an iPad Core Data application. I have
I tried importing the SVG XML Schema into EMF, to obtain the SVG metamodel
I am working on importing XML data into Django models. For example, I could
I want to import an XML file from polarpersonaltrainer.com that stores heartrate data into
Im importing HTML into my page via an XML feed. If the content has
I am importing data into a sql table from a csv using an xml
I have a winapp which writes data into a xml(Data.xml). This xml is my
I have an XML document and i need to import it into Django's database

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.