Copy link to clipboard
Copied
I want to know the best way to insert xml elements inside an InDesign document. Presently I am taking the following steps:-
1. Create a tag if it doesn't exists already.
2. Create an element using the tag above as child of the root element.
3. Move the new element to the desired word or text location inside a TextFrame.
The above steps work correctly but not all the time. Many times I get an error that says "The element cannot be moved to the destination.".
So, first two steps work without an error but third step some times throw the above stated error. Due to this exported xml shows all the unsuccessfully moved elements at the end of the root element. I want to know the possible reason behind this error. Please help me as I need to solve this issue ASAP.
Copy link to clipboard
Copied
Hi,
have you tried to markup the given word:
var wordTag = curDoc.xmlTags.itemByName(wordTagName);
var wordXmlElement = rootXmlElement.xmlElements.add(wordTag);
curWord.markup(wordXmlElement);
If you move the XmlElement you change the structure of the document
Copy link to clipboard
Copied
Many times I get an error that says "The element cannot be moved to the destination.".
Are you possibling trying to markup a text which could:
a) be hidden (overflowing text)
b) be on a locked layer
c) be on a hidden layer
d) be locked (textframe locked)
?
Loic