Skip to main content
October 8, 2014
Answered

I am new in indesign scripting, please tell me how to write a script to get content of a element in xml and then sort all the content

  • October 8, 2014
  • 1 reply
  • 403 views

I am new in indesign scripting, please tell me how to write a script to get  content of a element in xml and then sort all the content

This topic has been closed for replies.
Correct answer BEGINNER_X

Hi,

May the below code is useful for you, but I dont know how to sort.

Edit the tag as per your job request.

alert(app.activeDocument.xmlElements[0].contents)

  

//Second alert

var xe = app.activeDocument.xmlElements[0].evaluateXPathExpression("//marginalnote");

alert(xe.length)

for(i=0; i<xe.length; i++)

{

    alert(xe.texts[0].contents)

  

    }

Regards

Siraj

1 reply

BEGINNER_X
BEGINNER_XCorrect answer
Legend
October 8, 2014

Hi,

May the below code is useful for you, but I dont know how to sort.

Edit the tag as per your job request.

alert(app.activeDocument.xmlElements[0].contents)

  

//Second alert

var xe = app.activeDocument.xmlElements[0].evaluateXPathExpression("//marginalnote");

alert(xe.length)

for(i=0; i<xe.length; i++)

{

    alert(xe.texts[0].contents)

  

    }

Regards

Siraj

October 8, 2014

Thanks very much I just want to make sure evaluateXPathExpression("//etmfile");  etmfile is my element name and if  I put it on loop is it work

As I have to find out all these elements in the XML  with their page information.

Kindly suggest