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 CreateContentWizard.java file. And find that it uses “render(formInstanceData, renditionAVMPath)” method of “RenderingEngineTemplateImpl.java” 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(Assert.java:113)
        at org.springframework.web.jsf.FacesContextUtils.getWebApplicationContext(FacesContextUtils.java:50)
        at org.springframework.web.jsf.FacesContextUtils.getRequiredWebApplicationContext(FacesContextUtils.java:81)
        at org.alfresco.web.app.Application.getRootPath(Application.java:350)
        at org.alfresco.web.forms.FormsService.getContentFormsNodeRef(FormsService.java:169)
        at org.alfresco.web.forms.FormsService.getForm(FormsService.java:219)
        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(RetryingTransactionHelper.java:308)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:215)
        at org.alfresco.sample.RenditionWebsctipt.executeImpl(Unknown Source)
        at org.alfresco.web.scripts.DeclarativeWebScript.executeImpl(DeclarativeWebScript.java:250)

Please suggest me a way to render XML file programmatically.

Thanks in advance.

Outcomes