Copy link to clipboard
Copied
Hi Experts,
I need to fetch the xml content values using a script, i have attached the image below, in that the content values within CDATA need to be dispalyed. How do i do this???????????
Thanks In Advance
Regards,
ParvathiKannan.
Fetching CDATA has already been answered on above mentioned thread.
var allCDATA = [];
var myXMLFile = File("C:/Users/r.sunil/Desktop/TestingCDATA/Test.xml");
myXMLFile.open('r');
var allElements = new XML(myXMLFile.read());
myXMLFile.close();
var allFeatureElements = allElements.xpath("//feature");
for(var n = 0; n < allFeatureElements.length(); n++){
if(allFeatureElements.children().length() > 0){
getChildData(allFeatureElements);
}
}
//===================
function getC
...
Copy link to clipboard
Copied
See the following. I suppose it should help
https://community.adobe.com/t5/indesign/fetching-xml-contents-from-indd/m-p/11503311#M399292
-Manan
Copy link to clipboard
Copied
Fetching CDATA has already been answered on above mentioned thread.
var allCDATA = [];
var myXMLFile = File("C:/Users/r.sunil/Desktop/TestingCDATA/Test.xml");
myXMLFile.open('r');
var allElements = new XML(myXMLFile.read());
myXMLFile.close();
var allFeatureElements = allElements.xpath("//feature");
for(var n = 0; n < allFeatureElements.length(); n++){
if(allFeatureElements.children().length() > 0){
getChildData(allFeatureElements);
}
}
//===================
function getChildData(nodeData){
for(var c = 0; c < nodeData.children().length(); c++){
if(nodeData.children()[c].toXMLString().toString().indexOf("<![CDATA[") == 0){
alert(nodeData.children()[c].toString());
allCDATA.push(nodeData.children()[c].toString());
}
if(nodeData.children()[c].children().length() > 0){
getChildData(nodeData.children()[c]);
}
}
}
alert(allCDATA);
Best
Sunil
Copy link to clipboard
Copied
Dear Sunil,
ThankYou!
I've made some changes in the above code and now i'm able to reach what i want....
Thanks,
ParvathiKannan.