1 Reply Latest reply on Apr 18, 2012 5:54 AM by TD_TAD

    CS4- JS : How to change the DTD Option - Reg.

    Adobe-InDesign CS4 Level 1

      Dear All,


      I'm struggle to not getting the answer for change the DTD options though Script.


      Here I can Load the DTD using script and Validate then Its showing so many Errors, It means the root element is wrong [DOCTYPE] so the way I can change as per the XML Root Element.


      Root Element : Chapter

      Load DTD -> DOCTYPE name is  : text


      //================ Start Coding =================================//

      app.doScript(File("D:/program files/Adobe InDesign CS4/Scripts/XML Rules/glue code.jsx"));

      var myDoc = app.documents.item(0);
      var Store = new  Array();
      var count=0;


      myDTDPath = "C:\\Program Files\\Adobe\\Adobe InDesign CS4\\Executables\\Parser\\Macmil.dtd";




      function main()
        if (app.documents.length != 0)
          var myDocument = app.documents.item(0);
          //This rule set contains a single rule.
          var DTDTitle  = new Array (new DTDRootTitle);

           var elements = xmlElements;
           __processRuleSet(elements.item(0), DTDTitle);
          alert("No open document");
        //Adds a return character at the end of every XML element.
          function DTDRootTitle()
            this.name = "DTDValidation";
            //XPath will match on every XML element in the XML structure.
            this.xpath = "//chapter";
            // Define the apply function.
             this.apply = function(elm, myRuleProcessor)
                     Store[count] = elm.validate();
                return true;// Succeeded
              } //End of apply function

         for(var k=0; k<Store.length; k++)
              var test = Store[k];
               for(var m=0; m<test.length; m++)
                if(test[m].isValid == true)


      //========================== End of the coding ==========================//


      Question : 1

      Manually I can load the DTD & change the DTD Options as per the Root Element of the XML.

      After Validate using Root Element Itself, Its working fine. Zero Errors.

      Mean while I can Load DTD though Script but I can't change the DTD Options, through Script.


      So Please any one can give me the solution for change the DTD Options using script.


      Please any one can give the solution, Really I can appriciate for this...


      Hope I'm waiting the result for this query....



      Thanks & Regards

      T.R.Hairhara Sudhan