Copy link to clipboard
Copied
I've made progress, and hit a wall. Turns out:
SO... my questions:
Thanks much,
Pete
Copy link to clipboard
Copied
I'd love any hints, and/or confirmation that others can replicate this issue.
Copy link to clipboard
Copied
Hi,
Don't know if it helps but you can generate a parent XMLElement on the fly and move the xmlElement inside.
app.selection[0] is some tagged text.
"parentXE" is the markupTag you want to use for the parent
var refXE = app.selection[0].associatedXMLElements[0];
var parentXE = refXE.parent.xmlElements.add ( "parentXE" );
refXE.move ( LocationOptions.UNKNOWN , parentXE )
For the doc, consider Jongware html files.
And for any request regarding Adobe Products : https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform
It sems that CS7 is going to review the XML engine. It may be time to supply ![]()
Loic
Copy link to clipboard
Copied
Sorry Loic, that does NOT work.
Yes, you can generate an XML element on the fly and move things inside. But that's not the same as directly generating a PARENT element. There is a difference.
Here's a very very basic example that demonstrates the issue.
#target indesign
var refXE = app. selection[0].associatedXMLElements[0];
var parentXE = refXE.parent.xmlElements.add ( "parentXE" );
refXE.move ( LocationOptions.UNKNOWN , parentXE );
The "parentXE" tag will first show up at the end of the Story. Then it will become the parent of Para1. (And will be at the end of the story).
If you now double click on the paragraphs and on parentXE, you will see some changes:
You can replicate this in the UI:
BUT if you slightly modify:
That's the issue in a nutshell.
Using "New Element" and making it parent (either in UI or in script) causes formatting to be broken/lost
But using "New Parent Element" in the UI works perfectly. I just don't know how to accomplish this in a script ![]()
Blessings,
Pete
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more