[opencms-dev] Show content of a plaint text file

Dominic Rothemel dominic at rothemel.de
Fri Jul 20 12:20:13 CEST 2018


Hi there,

I need a hint....

I just want to show the content of a plain text file from the VFS on my 
website.
(inside the plain text file is a XML configuration file from a software 
- but let's say it's just text (Type is "Text file")).

Because it's not a valid content file with schema, I failed to use the 
file directly.

So I created a document type with a VFSfileWidget and linked the plain 
text file.
Inside the container page is the "UploadVFSfile - 
UseCaseUpload-00001.xml" document and formatter showVFSfile.jsp.
But also with this construct I'm not able to put the content of the text 
file as a part in my website.


<cms:contentload collector="singleFile" 
param="/CorrelationRules/CorrelatonExport.xml">
    <cms:contentshow element="${opencms.filename}" />
</cms:contentload>

Container-page element "/CorrelationRules/UseCaseUpload-00001.xml" could 
not be rendered with formatter 
"/system/modules/test/formatters/showVFSfile.jsp".

javax.servlet.ServletException: javax.servlet.jsp.JspException: 
org.opencms.xml.CmsXmlException: Resource 
"/CorrelationRules/CorrelatonExport.xml" is not of required type XML 
content.Stack trace


Hope someone can help me.

Thanks
Dominic

PS: I don't want to put the content in a text field of a content file.
PPS: OpenCms 10.5.4



More information about the opencms-dev mailing list