Hi, i need to update an xml form in km, i can read and modify it with the following code:
IWDClientUser wdClientUser = WDClientUser.getCurrentUser();
IUser sapUser = wdClientUser.getSAPUser();
com.sapportals.portal.security.usermanagement.IUser ep5User = WPUMFactory.getUserFactory().getEP5User(sapUser);
// Getting the Resource.........
IResourceContext resourseContext = new ResourceContext(ep5User);
IResourceFactory resourseFactory = ResourceFactory.getInstance();
// path to the KM Folder ("path")
RID pathRID = RID.getRID(path);
com.sapportals.wcm.repository.IResource resource = resourseFactory.getResource(pathRID, resourseContext);
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
docBuilderFactory.setNamespaceAware(true);
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
Document doc = docBuilder.parse(resource.getUnfilteredContent().getInputStream());
doc.getDocumentElement().normalize (); //You can access the DOM using this "doc" object reference. //Do further processing...
doc.getDocumentElement().getElementsByTagName("Answer").item(0).getChildNodes().item(0).setNodeValue("La mala vita!!!");
The question is how i can save the changes in the same resource.
Regards