1 Reply Latest reply on Jul 11, 2013 11:10 PM by R-Bala-Krishnan

    How can I get values from the structure tree

    scriptingtyp

      Hey

      I want to make a script in Javascript, where I can change attributevalues in the structure tree. Can anyone give me an example how to do that?

        • 1. Re: How can I get values from the structure tree
          R-Bala-Krishnan Level 2

          var myDoc = app.documents.item(0);

          var rootEle = myDoc.xmlElements[0];

          var xrefXpath = rootEle.evaluateXPathExpression('//BookInfo'); //Xpath

          for(i=0; i<xrefXpath.length; i++){   

              var attributeValue =xrefXpath[i].xmlAttributes.itemByName("TocLevels").value;//getting a attribute value

              alert(attributeValue);   

              xrefXpath[i].xmlAttributes.itemByName("TocLevels").value = 2;    //setting a attribute value

              }

           

          --

          Bala