This content has been marked as final. Show 3 replies
In this line:
MyXMLElement.Move idLocationOptions.idBefore, MyCursorLocation
...you're mixing apples and oranges. You can only move XML elements relative to other XML elements (that is, the object you provide to the reference parameter in the XMLElement.Move method should be an XML element), not relative to text objects.
In truth, I think InDesign will sometimes let you get away with this, and move the element if the structure will allow it--but it's better to try to figure it out in terms of the XML structure.
The problem is that most of the time I don't want to move it in relation to another XML object, I always want it where ever the cursor is located at the time of the script. Do you know any way to do this?
It's a bit tricky to just grab an XML element and then move it to another location in the XML structure. It really depends on the structure surrounding the cursor. You might actually be better off moving the *text content* of the XML you've imported to the cursor position, and then re-tagging it. If the text has paragraph and character styles applied to it, you can simply use style to tag mapping to do most of the work for you.
I'll think about this a bit more, and try to come up with an example.