[opencms-dev] trying to find the correct function

Joe Desbonnet jdesbonnet at gmail.com
Tue Apr 4 00:11:46 CEST 2006


You're right -- doing search and replace on an XML file is dangerous.
Instead you can open the "HTML" file and read it into a DOM structure
using an XML parser. You can then programatically manipulate that DOM
structure.  Alternatively you can use XSLT to transform the XML.  Then
write the modified document back to the CMS.

Take a look at org.opencms.file.CmsFile methods getContent() and setContent().

Joe.

On 4/3/06, Pablo Caviglia <pablo.caviglia at gmail.com> wrote:
>
>
> Hi all!
>
> I am trying to develop a JSP page that receives a parameter from the
> request, and then it ´edits´ an HTML file to add the parameter value to an
> element of the HTML file.
>
> To be clear, the idea is this:
>
> I call a JSP located on the OpenCMS system passing the parameter 'test' with
> the value '123'.
> That JSP file will edit the 'control code' of an specific HTML file, and
> will replace the content of the element named 'test' with the value '123'.
>
> I need to know how can i open the specified HTML file to then edit an
> specific element of it. I think i already know the solution to make this via
> the string search/replace functionality, but i think that solution is
> probably not good. I guess there is some implemented functionality to
> replace the content of an element of a file... but i need to know where
> exactly and how to use it.
>
> Ok... hope someone can help me.
>
>
> Thanks!!!
>
>
>
>       Pablo
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
>
>



More information about the opencms-dev mailing list