Copy link to clipboard
Copied
Hi everyone,
i try to retrieve an all xml story on the xml structure of an InDesign document by clickinf a textframe that I know the associatedXMLElement ; It is possible
see example please
So, I click on the textframe on the InDesign document and get his associatedXMLElement (the markupTag name "texte"), then I want to get the parent node "doc" but I only the retrieve the "root" node ; after this I want iterate through the all node "doc".
help is welcome, thanks
AmƩrico
Try this:
if(app.selection[0].constructor.name == "TextFrame"){
var docNode = app.selection[0].associatedXMLElement.parent.parent;
for(var i = 0; i < docNode.xmlElements.length; i++){
$.writeln(docNode.xmlElements[i].name)
}
}
Best
Sunil
Copy link to clipboard
Copied
Try this:
if(app.selection[0].constructor.name == "TextFrame"){
var docNode = app.selection[0].associatedXMLElement.parent.parent;
for(var i = 0; i < docNode.xmlElements.length; i++){
$.writeln(docNode.xmlElements[i].name)
}
}
Best
Sunil
Copy link to clipboard
Copied
Hello Sunil,
I'm sorry this returns "undefined" and I'm looking for the associatedXMLElement
Regards
Copy link to clipboard
Copied
OH ! Sunil, I'm sorry, you right ; I had just "docNode.xmlElements[i].markupTag.name" and Waouhou
Regards,
Americo