How to retrieve a story by any associatedXMLElement

Explorer ,
Mar 16, 2021 Mar 16, 2021

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

Screen1.png

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

TOPICS
How to, Import and export, Scripting

Views

49

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Apr 07, 2021 Apr 07, 2021

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

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines