[opencms-dev] How to get HTML from a file in VFS

Bruno Teixeira bteixeira666 at gmail.com
Fri Mar 18 15:50:29 CET 2011


Hello there

I'm developing a feature that extracts some info from an HTML file in the VFS.
This is an example of how I'm reading the file contents:

<%
String path = "path/to/file.html";
CmsFile menuFile = cmsObj.readFile(path);
out.print(new String(menuFile.getContents()));
%>

The problem: I don't see the full HTML content of the file; instead I
see something like:

<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://www.opencms.org/dtd/6.0/xmlpage.xsd">
  <page language="pt">
    <element name="body">
      <links>
        <link name="link8" internal="false" type="A">
          <target><![CDATA[...]]></target>
        </link>
        <link name="link9" internal="false" type="A">
          <target><![CDATA[...]]></target>
        </link>
      </links>
      <content><![CDATA[   ....... the actual HTML contents, but
without the links....... ]]></content>
    </element>
  </page>
</pages>

I think you get the idea.
Is there any built-in way of getting the HTML contents as they are see
in the workplace editor?

Thank you.



More information about the opencms-dev mailing list