Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions “new XML()” not working sometimes on Extendscript

  • “new XML()” not working sometimes on Extendscript

    Posted by Miguel De mendoza on June 22, 2018 at 11:53 am

    Hi,I’m creating XML objects with this sintax:
    var element = "element";
    var xml = new XML("<"+element+"/>");

    But sometimes it doesn’t work. On the navigation tab, in the toolkit, “xml” appears as an empty xml object.

    For example, in this code:

    function KT_Data(name, value){
    this.name = (!name)?this.constructor.name : name;
    this.value = (!value)?0: value;

    this.toXml = function(xml) {
    var newXml = new XML("<" + this.name+ "/>"); //WORKS
    newXml.@type = "KT_Data";
    newXml.@class = this.constructor.name;
    for (var property in this) {
    var prop = this[property];
    if (typeof prop == "function") {continue}
    if (prop instanceof KT_Data){
    prop.toXml(newXml);
    } else if (prop instanceof Array) {
    this.arrayToXml(newXml, prop, property);
    } else {
    newXml[property] = prop;
    }
    }
    xml.appendChild(newXml);
    return xml
    }

    this.arrayToXml = function(xml, property, nodeName) {
    var newXml = new XML("<" + nodeName+ "/>"); //NOT WORKING
    newXml.@type = "Array";
    for (var i = 0; i < property.length; i++) {
    var element = property[i];
    var childXml = new XML("

    It works when I create the root element and inside toXml() function, but not working inside arrayToXml().

    Someone can figure out why is this happening?

    Miguel De mendoza replied 7 years, 10 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy