cancel
Showing results for 
Search instead for 
Did you mean: 

Xml file problems to update

Former Member
0 Kudos

hello experts i have a problem to update my xml file in mime folder im using resourcepath to generate the url then write it in.

so i have an iframe that load an html file in mime folder too. but this html show the xml file content but not show the last changed

can you help me pls !

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi, How you are reading xml file from  HTML.

Former Member
0 Kudos

Im using javascript in a html file that is refering to xml file in mimes path. This html file is loaded into a iframe.

ErvinSzolke
Product and Topic Expert
Product and Topic Expert
0 Kudos

I am wondering whether it is a good approach to alter files in that folder. It is like writing into the webcontent folder of a dynamic web application. I'd rather choose a different directory outside of the web application.

Former Member
0 Kudos

but the javascript only recognize this mime path. In that case which other positibility can i do ?

junwu
Active Contributor
0 Kudos

who told you that the xml can  be updated?

Former Member
0 Kudos

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.