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

Raghu D Raghu.Devaraj at ibsplc.com
Thu Jun 30 07:40:09 CEST 2011


Hi Fabian,

        Thanks a lot. It works fine now. :)

Regards,
Raghu D








From:   Fabian Huschka <fhsubscriptions at componio.net>
To:     Raghu D <Raghu.Devaraj at ibsplc.com>
Cc:     opencms-dev at opencms.org
Date:   06/29/2011 09:22 PM
Subject:        Re: [opencms-dev] <cms:contentshow element="Link"/>
Sent by:        opencms-dev-bounces at opencms.org



xmlContent.getValue("/Column1Name[1]/Column1/Link", enLocale, 
0).getStringValue(cmso); 

should give you the first link however in this case you better use 
something like:

List<I_CmsXmlContentValue> columns= xmlContent.getValues("Comment", 
Locale.GERMAN);

for (int i = columns.size() - 1; i >= 0; i--)
{
    I_CmsXmlContentValue column = columns.get(i);
    String nvalue = column .getDocument().getStringValue(cms, 
CmsFileUtil.addTrailingSeparator(column .getPath()) + "Column1/Link", 
enLocale);
}

On 29.06.2011 17:42, Raghu D wrote: 
Hi Fabian, 

        The value i am trying to get seems to be wrong.The  xml looks like 


<Column1Name><![CDATA[Promotions]]></Column1Name> 
    <Column1SummaryPage/> 
    <Column1> 
      <Text><![CDATA[SAA specials]]></Text> 
      <Link> 
        <link internal="true" type="WEAK"> 
 <target><![CDATA[/sites/default/specials/specials.html]]></target> 
          <uuid>47c7ea0b-f083-11df-b97c-07b4bbf14345</uuid> 
        </link> 
      </Link> 
    </Column1> 
<Column1Name><![CDATA[hotels]]></Column1Name> 
    <Column1SummaryPage/> 
    <Column1> 
      <Text><![CDATA[SAA specials]]></Text> 
      <Link> 
        <link internal="true" type="WEAK"> 
          <target><![CDATA[/sites/default/hotels/taj.html]]></target> 
          <uuid>47c7ea0b-f083-11df-b97c-07b4bbf14345</uuid> 
        </link> 
      </Link> 
    </Column1> 

        From the above one ,  i need to get the value 
<target><![CDATA[/sites/default/specials/specials.html]]></target> . Could 
you advise me on how to get the value. 

Thanks and Regards,
Raghu D. 







From:        Raghu D/IBS 
To:        Fabian Huschka <fhsubscriptions at componio.net> 
Date:        06/29/2011 07:17 PM 
Subject:        Re: [opencms-dev] <cms:contentshow element="Link"/> 


Hi Fabian , 

        Thanks for the advise.Now the IndexOutofBounds exception is solved 
. But i am getting the Null pointer exception @ 
String message = xmlContent.getValue("Link", enLocale, 
0).getStringValue(cmso);   

Could you advise whether the value i am trying to get not exist or due to 
some other reason. 

 Regards,
Raghu D 









From:        Fabian Huschka <fhsubscriptions at componio.net> 
To:        The OpenCms mailing list <opencms-dev at opencms.org> 
Cc:        Raghu D <Raghu.Devaraj at ibsplc.com> 
Date:        06/29/2011 06:57 PM 
Subject:        Re: [opencms-dev] <cms:contentshow element="Link"/> 



Hi, 

please use the filetranslator or 

String uri = cms.getRequestContext().getUri(); 
String tempUri= cms.getRequestContext().removeSiteRoot(uri);

to get rid of a potential site root. In your case there is surely no 
"/sites/default" in the URI thus the IndexOutOfBounds exception as you try 
to access the second element which does not exist. 
The rest of the code looks ok. 

\Fabian



On 29.06.2011 15:11, Raghu D wrote: 
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); 







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."










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."





_______________________________________________
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/20110630/39a2504c/attachment.htm>


More information about the opencms-dev mailing list