i am using an XML document as the source of my XUL frame as follows:
my xul file is test.xul & part of its code is as follows:

<iframe id="f" src="test.xml" />
<button label="hello" onclick="change()"/>

My XML file is as follows:
<page>
<pagenum>2</pagenum>
</page>

i load the xml document & i change the value of some node in my XML. i then
again set the value of my XUL frame, but the XUL frame loads the old XML
file. why is this?

The function change is defined as follows in change.js:
function change()
{
     if (document.implementation && document.implementation.createDocument)
 {
  xmlDoc = document.implementation.createDocument("", "", null);
  xmlDoc.onload = init;
 }
 xmlDoc.load("test.xml");
}


The function init is as follows()

function init()
{
    var x = xmlDoc.getElementsByTagName('page')
alert('value before changing 'x[0].childNodes[1].firstChild.nodeValue);
// displays value 2
 tag = document.createElement('pagenum');
 value = document.createTextNode('3');
 tag.appendChild(value);
x[0].replaceChild(tag,x[0].childNodes[1]);
alert('value after changing 'x[0].childNodes[1].firstChild.nodeValue);
// displays value 3
    var fr = document.getElementById('f');
    fr.setAttribute("src","xmlwrite.xml");
}


however setting src of the frame to the name of the XML file reloads the old
data, not the modified node. Why is this? is it that when
xmlDoc.load(("test.xml") is done a the file is copied into some temporary
area from where it has to be saved back into the original file using
xmlDoc.save() ? however as far as i know, xmlDoc.save is IE specific. is
there somerthing equivalent in mozilla?

plz help
thanx







Reply via email to