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

Mario Jäger m.jaeger at alkacon.com
Tue Oct 5 09:08:08 CEST 2010



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/20101005/b173b63b/attachment.htm>


More information about the opencms-dev mailing list