Copy link to clipboard
Copied
hai,
I am using javascript for printing xml contents. I can able to get xml file but i don't know how to print xml contents pls any one guide me.
The following code i can tried,
var myFile=File.openDialog("Choose Xml File","*.xml");
myFile.open("r");
var mycontent = myFile.read();
myFile.close();
myxml = XML(mycontent);
var myxpath=myxml.xpath("//book[1]")
var myValue=myxpath.attributes()
var myContents=xml_Contents(myxpath,myValue);
alert(myContents)
function xml_Contents(mxl,mycnt)
{
var myCont=[];
try
{
var myxm=XML(mxl);
if(myxm.contains(mycnt)==true)
{
myxm.descendants();
return myCont;
}
else
{
return null;
}
}
catch(e)
{
alert(e);
}
}
Thanks,
Sangeetha.K
Copy link to clipboard
Copied
InDesign cannot "print xml". You need to place it into an InDesign document first, and then print this instead.
If you want to manipulate "pure" XML (including printing it), you may be better off with using other software.
Copy link to clipboard
Copied
use this tool to test xml print https//jsonformatter.org/xml-pretty-print