AnsweredAssumed Answered

Modifying XML file with Business Rule

Question asked by lblancher@bizxcel.com on Feb 5, 2008
Latest reply on Feb 12, 2008 by gavinc
Hello,
  I am looking to update a file in the alfresco system, when another file is uploaded into a drop area, kind of like a historical list of files that pass through a space.  I am currently able to open and update the list file(in plain text format), but I would like to make the list file a xml file that I can apply a template(or style sheet) to.  After reading around the internet i found that Alfresco uses the Rhino Javascript engine from Mozilla.  I have there for looked at XML parsing JavaScript features for Firefox/Mozilla Browers. I have found two methods, but both result in exceptions generated in the alfresco.log file. 

First Method:
xmlDoc=document.implementation.createDocument("","",null);

Result:
TypeError: Cannot call method "createDocument" of undefined

Second Method:
var parser=new DOMParser();
var doc=parser.parseFromString(text,"text/xml");

Result:
ReferenceError: "DOMParser" is not defined.

I am using http://www.w3schools.com/dom/dom_parser.asp as my JavaScript reference for dealing with XML in JavaScript.

How can I resolve these errors? or how can I update a XML file from within  a Business Rule?

Thanks,
Lucas

Outcomes