AnsweredAssumed Answered

Programmatically XML Rendering

Question asked by Jayesh Prajapati on Jan 22, 2009
Hi All,

I want to render the xml file with respect to webform programmatically in alfresco WCM.

I am creating xml file in repository and linking it with webform using forminstancedata aspect. So now when I click in edit icon I am able to open that xml file in webform.

Now I want to render that xml file into html programmatically. I did some research on file. And find that it uses “render(formInstanceData, renditionAVMPath)” method of “” class.

I can not use this method directly from my java class because it uses FacesContext to load property file in that method. So if I try to access that method from my java class I will get error following error:

java.lang.IllegalArgumentException: FacesContext must not be null
        at org.springframework.util.Assert.notNull(
        at org.springframework.web.jsf.FacesContextUtils.getWebApplicationContext(
        at org.springframework.web.jsf.FacesContextUtils.getRequiredWebApplicationContext(
        at org.alfresco.web.forms.FormsService.getContentFormsNodeRef(
        at org.alfresco.web.forms.FormsService.getForm(
        at org.alfresco.sample.RenditionWebsctipt.doExample(Unknown Source)
        at org.alfresco.sample.RenditionWebsctipt$1.execute(Unknown Source)
        at org.alfresco.sample.RenditionWebsctipt$1.execute(Unknown Source)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(
        at org.alfresco.sample.RenditionWebsctipt.executeImpl(Unknown Source)
        at org.alfresco.web.scripts.DeclarativeWebScript.executeImpl(

Please suggest me a way to render XML file programmatically.

Thanks in advance.