[opencms-dev] Writing multiple nodes of the same name using CmsXmlContent

Yves Glodt yg at mind.lu
Thu Oct 6 10:36:15 CEST 2011


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20111006/173d99c8/attachment.htm>


More information about the opencms-dev mailing list