1 Reply Latest reply on Sep 23, 2008 5:57 AM by Kasyan Servetsky
      • 1. Re: XML attributes
        Kasyan Servetsky Level 5
        Hi james,

        I hope this example will help you:

        var myDoc = app.activeDocument;
        
        var myXMLTag = myDoc.xmlTags.add("myXML");
        var myXML = myDoc.xmlElements.item(0).xmlElements.add(myXMLTag);
        myXML.contents = ""; // empty string
        var myXMLTag_a = myDoc.xmlTags.add("myXML_a");
        var myXML_a = myXML.xmlElements.add(myXMLTag_a);
        myXML_a.contents = "Blah-blah-blah";
        // create a new attribute, set name and value
        var myAttribute = myXML_a.xmlAttributes.add("weight", "6");
        // get value
        alert("Initial value = " + myAttribute.value);
        // set new value
        myAttribute.value = "12";
        // get value again
        alert("New value = " + myAttribute.value);

        Kasyan