FW: [opencms-dev] Getting the raw content of an HTML file (was CmsJspActionElement.getContent () won't let me get the contents of an html file...)
Geoff Winkless
opencms at geoff.dj
Fri Jun 25 13:46:01 CEST 2004
M Butcher wrote:
> Take a look (edit sourcecode) of the /system/bodies version of the
> file -- it has two versions of the code: one that is the HTML
> generated by
> the editor and one that is cleaned by JTidy.
Brilliant!! Together with Olli's code (which basically grabbed the
"TEMPLATE" section from the XML of the /system/bodies file) and your
suggestion it now works.
All you have to do is modify the code to request the <edittemplate> section
of the XML instead of the <TEMPLATE> section: so the code looks like:
com.opencms.file.CmsFile reqFile=cms.getCmsObject().readFile(url);
com.opencms.template.CmsXmlControlFile ctl=new
com.opencms.template.CmsXmlControlFile(cms.getCmsObject(),reqFile);
com.opencms.template.cache.CmsElementDefinitionCollection
collection=ctl.getElementDefinitionCollection();
com.opencms.template.cache.CmsElementDefinition
def=collection.get("body");
com.opencms.template.CmsXmlTemplateFile templateObj=new
com.opencms.template.CmsXmlTemplateFile(cms.getCmsObject(),def.getTemplateNa
me());
return templateObj.getDataValue("edittemplate");
Thanks Olli and Matt for suggestions.
Geoff
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
More information about the opencms-dev
mailing list