I need to insert a word sqrt
(plain text without tags ) in the xml element of m:msqrt
like below:
I tried:
var path = (app.activeDocument.fullName.parent.fsName).toString().replace(/\\/g, '/');
//path of active document(sample.indd)
var xmlPath = (app.activeDocument.fullName.parent.fsName).toString().replace(/\\/g, '/')+"/with_aid2.xml";
xmlFile = File (xmlPath);
if(xmlFile.exists){
xmlFile.open();
var myString = xmlFile.read();
xmlFile.close();
myXml = new XML ();
myXml = XML(myString);
var msqrtCount = myXml.xpath("//m:msqrt");
}else{alert(xmlPath+" doesn't exist!");}
for(var i=0;i<msqrtCount.length();i++){
var added = msqrtCount[i];
added.contents="sqrt";
}
I get an error says invalid content property.