• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

406

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

correct answers 1 Correct answer

Advocate , Apr 07, 2021 Apr 07, 2021

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

Votes

Translate

Translate
Advocate ,
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

Votes

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
Explorer ,
Apr 18, 2021 Apr 18, 2021

Copy link to clipboard

Copied

Hello Sunil,

 

I'm sorry this returns "undefined" and I'm looking for the associatedXMLElement

 

Regards

Votes

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
Explorer ,
Apr 18, 2021 Apr 18, 2021

Copy link to clipboard

Copied

LATEST

OH ! Sunil, I'm sorry, you right ; I had just "docNode.xmlElements[i].markupTag.name" and Waouhou

 

Regards,

 

Americo

Votes

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