0 Replies Latest reply on Jun 29, 2009 5:11 PM by Thomas B. Nielsen

    Matching JS XML object with Indd XML elements

    Thomas B. Nielsen Level 3

      Hello Scripters,

       

      I need help ...

       

      I have some XML from a file read into a Javascript XML object.
      The object has the name "myXml", and contains:
          <book id="bk101">
              <author>Gambardella, Matthew</author>
              <title>XML Developer's Guide</title>
              <genre>Computer</genre>
              <imagecontainer href="C:\33415677.JPG"></imagecontainer>
              <price>44.95</price>
              <publish_date>2000-10-01</publish_date>
              <description><test>Sublevel</test>An in-depth look at creating applications with XML.</description>
          </book>
          ... and several other books

       

      I also have some XML in Indesign, wich in my JS is known as "myTplXmlRoot".
      myTplXmlRoot is defined as myTplXmlRoot = mySelection.associatedXMLElement;

       


      What would be the best approach for matching elements of the same name in the two xml structures, and where there is a match* replace the Indesign content**, with that from the object "myXml"?

       

      *) Match if same name, dont worry about place in hirachy
      **) content might be an image