Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

XML error namespace attribute

Community Beginner ,
Feb 19, 2019 Feb 19, 2019

I am outputting an SVG file using indesign javascript and when I try to execute the following line in the newest indesign cc version I get an error. However, it works in CS5. I suspect it has something to do with not defining a namespace that I am using in an attribute but I am not sure how to define it.

code that is giving an error:

new XML('<image xlink:href="' + imgName + '" />');

TOPICS
Scripting
705
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

People's Champ , Feb 21, 2019 Feb 21, 2019
var x = <image/>;

var ns = new Namespace ("xlink", "http://www.someuri.com/1.0");

x.addNamespace (ns);

x["@xlink:url"] = "tutu.jpg";

alert(x.toXMLString());

Translate
People's Champ ,
Feb 21, 2019 Feb 21, 2019
LATEST
var x = <image/>;

var ns = new Namespace ("xlink", "http://www.someuri.com/1.0");

x.addNamespace (ns);

x["@xlink:url"] = "tutu.jpg";

alert(x.toXMLString());

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines