Copy link to clipboard
Copied
Hi,
I tried to get particular attribute value of a element in xml.I used var description=mySel.associatedXMLElement.parent.xmlAttributes.itemByName("descriptions").value
. It returned 'Object is Invalid" error.What should be done to get the attribute value and to assign the link.?Please do guide on this..
Copy link to clipboard
Copied
Can you share the screenshot of your document showing the document structure xml. I have been able to get your code working in my sample document. See it working for me in the screengrab using the following link
-Manan
Copy link to clipboard
Copied
Hi Manan Joshi,
Thanks for your response. I have attached the screenshot of document xml structure.
In the below screenshot the attribute description_link carries a hyperlink need to apply for attribute description content.
Please guide me to complete this...
Thanks,
Jothi
Copy link to clipboard
Copied
Hi Jothi,
What is your mySel object refering to, i can't see any selection in the screenshot you gave. Also i am unable to see any attribute named descriptions in the screenshot. Maybe you have text as selection, in that case you may try the following code
var description=app.selection[0].associatedXMLElements[0].parent.xmlAttributes.itemByName("descriptions").value
-Manan
Copy link to clipboard
Copied
Sorry for inconvience., I have attached another screenshot with highlight marks. please do refer that
Copy link to clipboard
Copied
In the latest screenshot that you shared, the descriptions and descriptions_link are not attributes but xmlelements. The attributes are shown with a dot in front like attribute_id in your screenshot. Your structure does not match with your code nor did you explain what is in the mySel object. unless we know from object are trying to process its difficult to help you. Did you try my latest code?
-Manan
Copy link to clipboard
Copied
Yes! I have tried, but it shows an error message. I have uploaded the document to know the structure of xml and the link is
https://www.dropbox.com/preview/Sample/Sample.idml?role=personal
In this document I have placed two xml elements. descriptions and descriptions_link, where descriptions_link carries a link www.yahoo.com and description contains a some text. What i need is to apply the description_link to description texts using script. I have attached my expected output.
Regards,
Jothi
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more