0 Replies Latest reply on May 7, 2010 4:46 AM by PankChat

    Searching XML element attribute

    PankChat

      Hello all,

       

      I am in midst of my script wherein I am searching/selecting all the textframes on each page one by one and getting the GB of them+inserting some conditional text.

       

      All is well until I try to find the value of "id" attribute of element (top, which is <table id="table1"> or figure) CONTAINED BY THESE FRAMES. Basically they are the floats textframes. I am trying the following:

       

       

      for (var t=0;t<=totalTextFrames-1;t++)

      {

      var Text_FRAME = myDoc.pages[i].textFrames[t];

      var bottom_Bound_float = Text_FRAME.geometricBounds[2];

      var right_Bound_float = Text_FRAME.geometricBounds[3];

      Text_FRAME.insertionPoints.item(-1).contents="mark-this";

       

       

      -------------

      --------------

       

      Is there a way to iterate the xml elements of seleced textframe instead of whole document?

       

      I try to do something like this but script throws an error:

       

      var myRuleSet = new Array(new id_value);
        with(myDoc){
         var elements = xmlElements;
         __processRuleSet(elements.item(0), myRuleSet);
        }

       

      //}catch(err){}

       

      function id_value(){
      this.name = "id_value";
      this.xpath = "/table";
      this.apply = function(myElement, myRuleProcessor){
      with(myElement){
      //var idvalue=myElement.xmlElements.item (0).xmlAttributes("id").value;
      var idvalue=myElement.xmlElements.item (0).value;


      alert("Id value is "+idvalue);

      }
      return true;
      }

      }

      Anysuggestions will be high