Copy link to clipboard
Copied
Hello all,
I'm manually mapping styles to XML elements. I then have a script that that searches for a style and on the found object loops through the AssociatedXMLElements looking for the element name I need. When found the script updates that element's attributes.
This is working great for all the character styles for which I'm searching but its only working for SOME of the paragraph styles I'm searching. For the paragraphs that are NOT working I'm getting ONLY the "Story" XML element (the parent of the paragraph element) and NOT the element that is on the paragraph.
What is also interesting is that when I select the paragraph manually, right click and select "Select in Structure" it does NOT select the tag on the head, but also selects the Story parent element, like the script does.
Any again, I have SOME paragraphs for which the script DOES "see" the element on the paragraph.
Any ideas?
Thanks,
Ken
Copy link to clipboard
Copied
We've got a very similar problem.
Under certain circumstances, referring to the associatedXMLElements of the paragraph of an XMLElement,
only resulted in the associatedXMLElements of the parent story.
Something like this...
myElem.paragraphs.associatedXMLElements
myElem being an XMLElement like "test1" in the sample below:
<container>
<tech><test1/><test2/></tech>
<container>
The circumstances when this problem was found:
The parent tag "<tech>" was on the same row (same paragraph) as the elements (test1 and test2) we were trying to find.
Adding a line break (new paragraph) after the initial <tech> tag and before the ending one, makes the problem go away, but we can't have breaks there.
We made a workaround by going via the "words" collection of the paragraph instead, and found all relevant associatedXMLElements that way, but it seems there is a bug in InDesign.
// Andreas
Find more inspiration, events, and resources on the new Adobe Community
Explore Now