[opencms-dev] <cms:contentshow element="Link"/>

Raghu D Raghu.Devaraj at ibsplc.com
Wed Jun 29 15:11:10 CEST 2011


Hi Mario,

        Thanks for the advise.

        I tried to use the CmsXmlContentFactory and CmsXmlContent, but i 
am getting ArrayIndexOutofBounds exception.The code is shown below. Could 
you advise the reason for the error.

CmsJspActionElement cms = new CmsJspActionElement (pageContext, request, 
response);
CmsObject cmso = cms.getCmsObject();
String uri = cms.getRequestContext().getUri(); 
String tempUri= uri.split("/sites/default")[1] ; 
CmsFile file = cmso.readFile(tempUri)   ;
CmsXmlContent xmlContent = CmsXmlContentFactory.unmarshal(cmso,file);
String message = xmlContent.getValue("Link", enLocale, 
0).getStringValue(cmso);



Regards,
Raghu D







From:   Mario Jäger <m.jaeger at alkacon.com>
To:     opencms-dev at opencms.org
Date:   06/29/2011 05:40 PM
Subject:        Re: [opencms-dev] <cms:contentshow element="Link"/>
Sent by:        opencms-dev-bounces at opencms.org



Hi Raghu,

I think, that you want to know how to get an xml content element value 
in a Java Bean for example.(?) Therefore, you have to unmarshal the file 
using the org.opencms.xml.content.CmsXmlContentFactory.unmarshal() 
method. You have the org.opencms.xml.content.CmsXmlContent object from 
that file then. With the XPath from the element (you want the value 
from) you can get the value using the getValue() methods on that object 
then.

Kind Regards,
Mario.



Am 29.06.2011 07:12, schrieb Raghu D:
> Hi All,
> Is it possible to get the value of <cms:contentshow element="Link"/> in
> java ?
>
> Thanks and Regards,
> *Raghu D*
>
>
>
>
>
>
>
>

>
>
>
>
>
>
> _______________________________________________
> 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


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

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

_______________________________________________
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







DISCLAIMER: 

"The information in this e-mail and any attachment is intended only for 
the person to whom it is addressed and may contain confidential and/or 
privileged material. If you have received this e-mail in error, kindly 
contact the sender and destroy all copies of the original communication. 
IBS makes no warranty, express or implied, nor guarantees the accuracy, 
adequacy or completeness of the information contained in this email or any 
attachment and is not liable for any errors, defects, omissions, viruses 
or for resultant loss or damage, if any, direct or indirect."




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20110629/deea9fc8/attachment.htm>


More information about the opencms-dev mailing list