Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

xml tag and attribute

Return to Member Forum

  • Author
    Posts
    • #77434
      Rose Sall
      Member

      Hello All
      I have a small issue. I have an arraylist of xml tags that i am reading from a xml file. I am looping through the arraylist using FOR EACH and displaying the tags as nested tags in the indesign document. For ex: <tag1><tag2><tag3>HELLO ALL</tag3></tag2></tag1>

      I want to add the xml attribute values to the tags. But add the attribute and its value to the first tag only. But since i am looping the values are getting added to all the tags.

      Can anyone please tell me what i should do? I want the output as :
      <tag1 attribute=value><tag2><tag3>HELLO ALL</tag3></tag2></tag1>

      Please help

      Thanks

    • #77599
      Anonymous
      Inactive

      Hi,

      While the idea is pretty clear, it’s not with the technology you are using. FOR EACH evokes XSLT, while arrayList is nothing that I know of (is a that a JS array you are talking about or an AS3 arrayCollection ? ).

      If the tags are exactly names tag1, you could use a xpath expression on the root element :

      app.activeDocument.xmlElements[0].evaluateXPathExpression (“//tag1”);

      That would return an array of XMLElements tagged “tag1”.

      If tags have different names but their position condition the attributes definition, then it’s also reachable through XPath but it needs a better context definition here.

Viewing 1 reply thread
  • The forum ‘General InDesign Topics (CLOSED)’ is closed to new topics and replies.
Forum Ads