1 Reply Latest reply on Jun 23, 2009 10:36 AM by Thomas B. Nielsen

    Get textFrame of placed XmlElement

    west98

      Hello,

       

      what is the easiest/prefered way to get the textFrame of a placed XmlElement (Javascript, CS4)?

       

      I work with xml rules to place content in my document. After having processed some rules (and placed some elements) I need to know in a later processed rule where in the document a specific element already has been placed. How do I get the textFrame from the XmlElement?

       

      West98

       

       

       

          function someRule() {
              this.name = "someRule";
              this.xpath = "//article";

       

              this.apply = function (element, ruleProcessor) {

       

                  var tf = element. ???
                 
              }
          }

        • 1. Re: Get textFrame of placed XmlElement
          Thomas B. Nielsen Level 3

          If you know that xml tagged with article always is a textframe, you can do:

           

              function someRule() {
                  this.name = "someRule";
                  this.xpath = "//article";

           

                  this.apply = function (element, ruleProcessor) {

           

                      var tf = element.xmlContent.parentTextFrames[0];

           

                  }
              }

           

          There might be a better way, but this should do the trick.