[opencms-dev] Writing multiple nodes of the same name using CmsXmlContent
Yves Glodt
yg at mind.lu
Thu Oct 6 13:47:17 CEST 2011
Hi Paul,
this seems to work. Thank you for your help !
On 6 October 2011 11:00, Paul-Inge Flakstad <flakstad at npolar.no> wrote:
> Hi Yves,****
>
> ** **
>
> Maybe something like this (I haven’t tested this):****
>
> ** **
>
> xmlContent.addValue(cmsObject, "Tag", new Locale("en"), 0).
> setStringValue(cmso, "iPod");****
>
> xmlContent.addValue(cmsObject, "Tag", new Locale("en"),
> 1).setStringValue(cmso, "iPhone"); ****
>
> xmlContent.addValue(cmsObject, "Tag", new Locale("en"),
> 2).setStringValue(cmso, "iPad");****
>
> ** **
>
> HTH****
>
> ** **
>
> Cheers,****
>
> Paul****
>
> ** **
>
> *From:* opencms-dev-bounces at opencms.org [mailto:
> opencms-dev-bounces at opencms.org] *On Behalf Of *Yves Glodt
> *Sent:* 6. oktober 2011 10:36
> *To:* The OpenCms mailing list
> *Subject:* [opencms-dev] Writing multiple nodes of the same name using
> CmsXmlContent****
>
> ** **
>
> Hello,
>
> I have a problem writing mulsiple nodes of the same name using the OpenCms
> Api.
>
> This is what I want to achieve:
>
> <XmlContentDocSimpleTypes xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="opencms://sites/knowledgebase/core/document.xsd">
> <XmlContentDocSimpleType language="en">
> <Title><![CDATA[My Title]]></Title>
> <Content name="Content0">
> <links/>
> <content><![CDATA[<p>lorem ipsum ...</p>]]></content>
> </Content>
> <Tag><![CDATA[linux]]></Tag>
> <Tag><![CDATA[web]]></Tag>
> <Tag><![CDATA[java]]></Tag>
> <Author><![CDATA[me]]></Author>
> <ChangedDate>1317474420000</ChangedDate>
> </XmlContentDocSimpleType>
> </XmlContentDocSimpleTypes>
>
>
> And this is how I proceed:
>
> CmsXmlContent xmlContent = null;
>
> I_CmsXmlContentValue xmlContentValue = null;
>
> xmlContentValue = xmlContent.getValue("Title", new Locale("en"));
> xmlContentValue.setStringValue(cmso, "My Title");
>
> ...
>
> xmlContentValue = xmlContent.getValue("Tag", new Locale("en"));
> xmlContentValue.setStringValue(cmso, "linux");
>
>
> If I repeat the last 2 calls, of course the "Tag" node is replaced.
> How can I add another "Tag" ? :-)
>
>
> Best regards,
> Yves****
>
>
> _______________________________________________
> 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/20111006/eecd2ec7/attachment.htm>
More information about the opencms-dev
mailing list