[opencms-dev] Getting content of a file

ambiesense at gmx.de ambiesense at gmx.de
Tue Apr 8 16:44:01 CEST 2003


you should get a byte array - thats right! But your content should be in
this array. Maybe you path is wrong? If you have stored your file in your VFS in
/Test/test.xml then your have to use this path for it.

Here an example code I have used to access an content file in OpenCMS's VFS.

CmsFile file = cmsObject.readFile("/Test/myXML.xml");
byte[] bytecontent = file.getContents();

You can use Java to transform this byte array in whatever you want. I have
used Xerces to traverse the XML structure.

Hope this helps!


> Dear Users,
> i am developing an intranet for our customer. I have developed some
> enhancements in Java and all works fine.
> Now i need to read the content of a file (html, xml or txt).
> I have the CmsFile Object, but when i call the getContents() method i
> get back a ByteArray with zero length.
> Is this the right way to access the content ?
> Please help
> Mario
> _______________________________________________
> 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

+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage!

More information about the opencms-dev mailing list