Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8667

Re: Xml file problems to update

$
0
0

i make the changes in the xml file using webdynpro:

 

xmlUrl = WDURLGenerator.getResourcePath

(wdComponentAPI.getComponent().getDeployableObjectPart(), "NOTICIAS/xml/eboseNews.xml");
DocumentBuilderFactory factory;
factory = DocumentBuilderFactory.newInstance();
factory.setValidating(true);
DocumentBuilder builder = factory.newDocumentBuilder();
Document xmldoc = builder.parse(xmlUrl);
xmldoc.getDocumentElement().normalize();
//NUEVO NODO HIJO DE CHANEL
Element itemElement = xmldoc.createElement("item");
IPublicFormularioCust.ICabNoticiaElement elemCab = wdContext.currentCabNoticiaElement();
     
//NODOSS HIJOS DE ITEM
Element titleElement = xmldoc.createElement("title");
titleElement.appendChild(xmldoc.createCDATASection(elemCab.getTitulo().trim()));
Element linkElement = xmldoc.createElement("link");
linkElement.appendChild(xmldoc.createCDATASection("docs/" + elemCab.getLink().getResourceName().trim()));
Element descripElement = xmldoc.createElement("description");
descripElement.appendChild(xmldoc.createCDATASection(elemCab.getDescripcion().trim()));
Element categoryElement = xmldoc.createElement("category");
categoryElement.appendChild(xmldoc.createCDATASection(elemCab.getCategoria().trim()));
Element pubdateElement = xmldoc.createElement("pubDate");
pubdateElement.appendChild(xmldoc.createCDATASection(new SimpleDateFormat("dd/MM/yyyy").format(Constantes.FECHACTUAL)));
//AGREGANDO NODOS HIJOS A ELEMENTO ITEM
itemElement.appendChild(titleElement);
itemElement.appendChild(linkElement);
itemElement.appendChild(descripElement);
itemElement.appendChild(categoryElement);
itemElement.appendChild(pubdateElement);
//AGREGANDO ELEMENTO ITEM
Node channelNode = xmldoc.getDocumentElement().getElementsByTagName("channel").item(0);
channelNode.insertBefore(itemElement, xmldoc.getElementsByTagName("item").item(0));
//Serializando el XMLDOC en un StringWriter
xmlSerializer.serialize(xmldoc);
FileWriter fw = new FileWriter(new File(xmlUrl));
fw.write(sw.toString());

so later i can see the changes but when i reloaded the page dont appear the changes only have the information when i deployed the project. This xml is show in with javascript. This javascript belongs to html file that is loaded into a iframe.


Viewing all articles
Browse latest Browse all 8667

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>