[opencms-dev] newbie: parse & modify generated page
Claus Priisholm
cpr at codedroids.com
Thu Aug 17 06:21:54 CEST 2006
Since you're on version 5 I suggest that you find the point where the
editor saves the content of a page.
In version five the original content as typed by the user is saved along
with a copy of the processed content (it gets jtidy'ed in order to
isolate the links so OpenCms later can insert the right ones).
I managed to hook up some extra DOM processing in there. The advantage
of this approach being that the overhead only occurs when saving rather
than when viewing the page.
You can of course also use servlet filters, but that typically adds the
overhead per page view.
Gerhard Erich Bruckner wrote:
> thanks for the comments. let me reformulate once more:
>
> is there any way of post-processing the output of e.g.
> cms.include( null, "body" ) ?
>
> the context: i want to add a filter that substitutes certain text nodes
> (if content matches regular expression) for nodes of other type
> (<acronym>, <a>, ...) after the page is assembled -> to force
> the content authors to have their abbreviations explained
> without interfering with their sources!
>
> i have a prototype javascript that performs very poorly - for that reason
> i would like to have it done on the server-side.
>
> we use opencms VERSION 5
>
> thx,
> gerhard
>
> On Mon, 14 Aug 2006, Shi Yusen wrote:
>
>> Hi Gerhard,
>>
>> What does elegant way mean? Generally, you can parse the page with jTidy.
>> You can download a weather module for OpenCms 5.0 (sorry, I cann't remember
>> the url for this module) and see what it does.
>>
>> Regards,
>>
>> Shi Yusen/Beijing Langhua Ltd.
>> --------------------------------------------------------------
>> Tel: 86-10-88514088, 88514099
>> Fax: 86-10-88514099
>> Email: shiys at langhua.cn
>> Website: http://www.langhua.cn/
>> --------------------------------------------------------------
>>
>> -----????-----
>> ???: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.
>> org] ?? Gerhard Erich Bruckner
>> ????: 2006?8?14? 18:34
>> ???: opencms-dev at opencms.org
>> ??: [opencms-dev] newbie: parse & modify generated page
>>
>> hi there!
>>
>> does anyone know of an elegant way of parsing and modifying the
>> already-generated DOM of an HTTP-response (for a certain project) before
>> returning the result to the browser?
>>
>> from my understanding, that can only be done in the somewhere close
>> to the main servlet. (the controller in MVC terms)
>>
>> any ideas? (for version 5)
>>
>> thx!
>>
>> _______________________________________________
>> 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
>>
>>
>> _______________________________________________
>> 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
>>
>
> _______________________________________________
> 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
>
--
Claus Priisholm, CodeDroids ApS
Phone: +45 48 22 46 46
cpr (you know what) codedroids.com - http://www.codedroids.com
cpr (you know what) interlet.dk - http://www.interlet.dk
--
Javadocs and other OpenCms stuff:
http://www.codedroids.com/community/opencms
More information about the opencms-dev
mailing list