<div>Hi List,</div><div><br></div><div>I have problem then update information 1 field in my xmlcontent, I lost all information and I dont cant update 1 field only, and preserve all other.</div><div><br></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; ">Anyone know how to do this? Update only one field XmlContent without losing too much?</span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; "><br></span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; ">Thank you,</span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; "><br></span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; ">Deiverson Silveira</span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; "><br></span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; "><br></span></div>
<div>The code:</div><div><br></div><div>String sName = "test field update";</div><div><br></div><div>try{</div><div><br></div><div>CmsXmlContentDefinition cd = CmsXmlContentDefinition.unmarshal(cmsObject, "/system/modules/my.project/schemas/city.xsd");</div>
<div>CmsXmlContent xmlcontent = CmsXmlContentFactory.createDocument(cmsObject,locale,org.opencms.main.OpenCms.getSystemInfo().getDefaultEncoding(),cd);</div><div><br></div><div>xmlcontent.getValue("Title", Locale.ENGLISH).setStringValue(cmsObject, String.valueOf(sName));</div>
<div><br></div><div>// Dont work.......... lost information field past =/</div><div>xmlcontent.getValue("SubTitle", Locale.ENGLISH).setStringValue(cmsObject, String.valueOf(xmlcontent.getStringValue(cmsObject,"SubTitle", Locale.ENGLISH)));</div>
<div>// I need redefinition all fields again???</div><div><br></div><div>byte[] content = xmlcontent.marshal();</div><div><br></div><div>String nameFile = "/test.html";</div><div><br></div><div>// cmsObject.writeFile(nameFile , org.opencms.main.OpenCms.getResourceManager().getResourceType("cidade").getTypeId(),content,new ArrayList());</div>
<div>// cmsObject.createResource("nameFile", org.opencms.main.OpenCms.getResourceManager().getResourceType("contato").getTypeId(),content,new ArrayList());</div><div><br></div><div> cmsObject.lockResource(nameFile);</div>
<div> cmsObject.replaceResource(nameFile, org.opencms.main.OpenCms.getResourceManager().getResourceType("cidade").getTypeId(),content,new ArrayList());</div><div><br></div><div> cmsObject.unlockResource(nameFile);</div>
<div>// cmsObject.publishResource(nameFile);</div><div><br></div><div> }</div><div>catch(Exception exc)</div><div>{</div><div>out.println("Erro: " + exc.getMessage());</div><div><br></div><div>}</div>