W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2002

ReplaceData

From: <Eric.Reiter@ic.lu>
Date: Tue, 17 Sep 2002 14:02:28 +0200
Message-ID: <57D5A4DAAEA0D611AFEE00D0B7DBA2F9392A85@PRIMERGY_02>
To: www-dom@w3.org

Hello

I would like to replace data in an XML node from an HTML form.

Here is my XML file:
----------------------------------------------------------------------
<suivi>
	<part>
		<entree>
		......
		</entree>
		<entree>
			.......
		</entree>
		<entree>
			<jour>4. JES05.09.02</jour>
			<tk>32400</tk>
			<typdoc>
			</typdoc>
			<lgmod>
			</lgmod>
			<resplay>ere</resplay>
			<page>40</page>
			<langue>IT</langue>
			<render>
			</render>
			<is></is>
			<remarque></remarque>
		</entree>
	</part>
</suivi>
----------------------------------------------------------------------------
------

Here is my script :
----------------------------------------------------------------------------
-----
function modiflg(){
tkCible=document.form1.tk.value;
newlg=document.form1.lgmod.value;
confirmation=confirm("Voulez-vous réellement modifier la langue modèle de la
TK  "+tkCible+"?")
if (confirmation==true){
var xmlDoc = new ActiveXObject("MSXML.DOMDocument");
var oSelection;
xmlDoc.setProperty("SelectionLanguage", "XPath");
xmlDoc.async = false;
xmlDoc.load("suivi.xml");
oSelection = selectNodes("//entree[child::tk='"+tkCible+"']/lgmod");
oSelection.replaceData(0,2,newlg);
xmlDoc.save("suivi.xml");
alert ("Langue modèle pour "+tkCible+" modifiée");}
else{alert(tkCible+" n'a pas été modifiée")}
}
----------------------------------------------------------------------------
-------------------

Unfortunatunately, it doesn't work. Can someone, please, help me?
Thanks
Eric
Received on Tuesday, 17 September 2002 08:03:08 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:56 GMT