Copy link to clipboard
Copied
Hi Team,
I am tring to get XML element into a labeled textframe. but am getting error as "XMLelement us read only".
Sample Code:
var XMLElement = app.activeDocument.xmlElements[0];
XMLElement.placeXML(app.activeDocument.pages[0].textFrames.itemByName("FIRST"));
kindly refer attached snap.
Check that the text frame isValid before passing it to the placeXML method. It does not appear that you have a valid text frame. What does your layer panel look like with that green frame selected?
Copy link to clipboard
Copied
Just change the name of your variable. There's a reason why "my" is used at the start of variable names in sample code. You're trying to access the DOM with that variable name.
var myXMLElement = app.activeDocument.xmlElements[0];
myXMLElement.placeXML(app.activeDocument.pages[0].textFrames.itemByName("FIRST"));
Copy link to clipboard
Copied
Thanks @brianp311,
But getting another error,
I need place XML element into a labeled textframe.
But facing error.
Advance Thanks
Copy link to clipboard
Copied
Check that the text frame isValid before passing it to the placeXML method. It does not appear that you have a valid text frame. What does your layer panel look like with that green frame selected?