Home › Forums › General XMetaL Discussion › Display Default Image › Reply To: Display Default Image
Reply to: Display Default Image
March 28, 2012 at 9:35 amhere is my code i used to update the node value. Not sure what I did wrong but it updates the xml file itself and when I try to close the file then it says it has been modified and must be saved. Hope you can find what i am doing wrong.
[code]if (ActiveDocument.ViewType == sqViewNormal || ActiveDocument.ViewType == sqViewTagsOn)
{
var doc = Application.ActiveDocument;
var graphicElemList = doc.getElementsByTagName(“graphic”);
for(var i = 0; i < graphicElemList.length; i++)
{
var graphicElem=graphicElemList.item(i);
if(endsWith(graphicElem.attributes.getnamedItem(“fileref”).nodeValue,”pdf”))
{
graphicFilerefNode=”icon-pdf.jpg”;
var updatedelem= graphicElem.setAttribute(“fileref”, “icon-pdf.jpg”);
doc.SetRenderedContent(graphicElem, updatedelem);
}
}
}[/code]
with best regards,
rnv