Quantcast
Channel: Adobe Community : Popular Discussions - InDesign Scripting
Viewing all articles
Browse latest Browse all 15932

Change content with XPath

$
0
0

Dear all,

 

I am attempting to search for XML elements in my document using XPath, and then alter its contents. I do realize that this is supposed to be a rather basic action, but documentation on this matter is surprisingly scarce/unclear (or perhaps my search skills are merely lacking).

 

Currently, I attempted to use evaluteXPathExpression, but I have no clue whether that is the right way to go. By any means, any iteration I try to make does not get through.

 

var myDocument = app.activeDocument;
var myRootXML = myDocument.xmlElements[0];
var myXMLPath = myRootXML.evaluateXPathExpression("//Test[1]/Test[1]");
myXML.insertTextAsContent("Sample text", XMLElementPosition.ELEMENT_END);

 

Kind regards and thanks in advance,

 

Julian


Viewing all articles
Browse latest Browse all 15932

Trending Articles