[opencms-dev] Use openCms to generate xml page, not html.

Dupont, Stephane Stephane.Dupont at getronics.com
Thu Feb 10 10:55:22 CET 2005


Thanks a lot for your quick answer.
Your solution helps me enormously.

Best Regards,
Stephane


-----Message d'origine-----
De : opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] De la part de Alexander Kandzior
Envoyé : mercredi 9 février 2005 17:13
À : 'The OpenCms mailing list'
Objet : RE: [opencms-dev] Use openCms to generate xml page, not html.


> My idea was to get this xml content as it is and return it in the jsp. 
> But i wouldn't recreate explicitly all the XML markup regarding again 
> the xml schema, all the more so since that the parsed xml content is 
> already well formed.

Here's a simple trick how to achive this. I'll show how to do this with the content of the "templateone" XML content demo. 

First, in the /xmlcontent/ folder, create a file "xmldump.jsp" with the following content:

-------------------
<%@page import="org.opencms.jsp.*, org.opencms.file.*" %><%

CmsJspActionElement cms = new CmsJspActionElement(pageContext, request, response);

String uri = cms.getRequestContext().getUri(); CmsFile file = cms.getCmsObject().readFile(uri); // note that this dosen't handle charsets byte[] content = file.getContents(); String result = new String(content);

out.println(result);

%>
--------------------

Now go to any article file in the folder and open the property editor. In the advanced property view, locate the "template-elements" property. Change this to point to the newly created file e.g. "/xmlcontent/xmldump.jsp". 

Now the XML should be dumped directly.
In order to not do this for all files individually, just do it on the folder where the XML content files are located.

Best Regards,
Alex.

Alexander Kandzior
Alkacon Software - The OpenCms Experts
http://www.alkacon.com

 



_______________________________________________
This mail is send to you from the opencms-dev mailing list To change your list options, or to unsubscribe from the list, please visit http://mail.opencms.org/mailman/listinfo/opencms-dev



More information about the opencms-dev mailing list