[opencms-dev] Map OpenCmsHmtl element as plain text to property

Paul-Inge Flakstad flakstad at npolar.no
Fri Oct 22 00:29:14 CEST 2010


Hi Mario,

Thanks a bunch - easy, clean approach and works like a charm! ;-)

Cheers,
Paul

________________________________
From: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Mario Jäger
Sent: 5. oktober 2010 09:08
To: The OpenCms mailing list
Subject: Re: [opencms-dev] Map OpenCmsHmtl element as plain text to property


Hi Paul,

I think, you have to implement your own xml content handler for that. Your Xml content handler should extend the default xml content handler org.opencms.xml.content.CmsDefaultXmlContentHandler.java. But, your handler should
overwrite the method resolveMapping(). In this method you have to implement your logic, that for some properties the plain text is mapped only. With the method CmsHtmlExtractor.extractText() you get the plain text. The XML
content handler to use must be specified in the appinfo section of the XSD defining the XML content:

<xsd:annotation>
  <xsd:appinfo>
  <handler class="mypackage.myContentHandler" />
  ...

Please note, that your own xml content handler should be in your own module. Otherwise it is overwritten after an OpenCms update.


--
Kind Regards,
Mario.

-------------------
Mario Jäger

Alkacon Software GmbH  - The OpenCms Experts
http://www.alkacon.com - http://www.opencms.org

Am 14.09.2010 12:49, schrieb Paul-Inge Flakstad:
Hi all,

Is there an easy way to map an OpenCmsHtml element as plain text to a property?

I have an ingress field (type OpenCmsHtml) mapped to the Description property, and I want the property to contain only the plain text, not the HTML markup.

Best regards,
Paul



_______________________________________________
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20101022/7005b288/attachment.htm>


More information about the opencms-dev mailing list