3 Replies Latest reply on Apr 1, 2008 10:38 PM by droom dp

    XMLattribute

    droom dp Level 1
      I have trouble to figure out how to add some XML attributes to XML elements before I do XML export.
      I'm using Javascript. Can someone give me a hint ?

      Regards,
      Droom
        • 1. Re: XMLattribute
          srakete Level 1
          Hi droom,
          this is how you can add an xmlAttributes to the root Xml Element:

          myDoc = app.activeDocument;
          myRootXMLElement = myDoc.xmlElements.item(0);
          myRootXMLElement.xmlAttributes.add("jobname", myDoc.name)

          Hope this helps

          Stefan

          http://www.indesignscript.de
          • 2. Re: XMLattribute
            droom dp Level 1
            Stefan,

            This helped me a lot, I was trying: myDoc.XMLElements.item(0);... unfortunately "xml" had to be in lower case.

            Thanks a lot,
            Droom
            • 3. Re: XMLattribute
              droom dp Level 1
              Anyone any idee how it works in inCopy ?
              (I know this is not the right forum, but the InCopy-one is soo small)

              When I execute the same code as in InDesign, I do not see the added XMLattribute in the XML three, nor in the XML export.
              But when I ask by javascript the number of created attributes, the count is correct !? So somewhere, somehow, the attribute exists.

              Kind Regards,
              Droom