Sto rendendo una funzione Cross-Browser e preferirei non cambiare gli input, per non dover andare a cambiare tutte le chiamate.
questa funzione riceve come paramentro un path di un nodo e una stringa contenente un albero xml.
Non riesco a trovare un modo di come cambiare il valore di un nodo

codice:
//sSimpleXPath="buildsets/buildset[setobject='SetPerson']/number"
/*
sXML="<buildsets><setsname>View</setsname><buildset><setobject>SetPerson</setobject><setname>Person</setname><number>0</number><selected>true</selected><defaultobject>Person</defaultobject><defaultxslt>formview</defaultxslt></buildset><buildset><setobject>SetPosition</setobject><setname>Position</setname><number>0</number><selected>false</selected><defaultobject>Position</defaultobject><defaultxslt>datasheet</defaultxslt></buildset></buildsets>"
*/
function xmlNodeValue(sSimpleXPath, sXML, sNewValue)
{
		var oXML;
		var parser;
		if (window.DOMParser)
		{
			parser=new DOMParser();
			oXML=parser.parseFromString(sXML,"text/xml");

               if (sNewValue || sNewValue == 0)
		{

/* codice che funziona solo in IE
                        var oXML = new ActiveXObject("Microsoft.XMLDom");
			oXML.async = false;
			oXML.loadXML(sXML);
			var oNode = oXML.selectSingleNode(sSimpleXPath);
			if (sNewValue || sNewValue == 0)
			{
				if (oNode)
				{
					//return whole XML string if an update
					oNode.text = sNewValue;
					return oXML.xml; 
}
}
*/
return (/*una stringa tipo sXML*/)
}
else
{
			var oNode = oXML.evaluate(sSimpleXPath, oXML, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
//return just the node is simply a 'fetch'
                        return oNode.singleNodeValue.textContent
}
Spero di esser stato chiaro
e vi rigrazio in anticipo