I am trying to add an attribute into an xml node. I have created the following function
function AddAttribute(xmlNode, attrname, attrvalue, path) {
var att
I have found a possible solution. At least it works now for the three browsers : IE, Firefox and Chrome.
function AddAttribute(xmlNode, attrname, attrvalue, path) {
var attr;
if (xmlNode.ownerDocument.createAttributeNS)
attr = xmlNode.ownerDocument.createAttributeNS("http://www.firmglobal.com/MyNameSpace", attrname);
else
attr = xmlNode.ownerDocument.createNode(2, attrname, "http://www.firmglobal.com/MyNameSpace");
attr.nodeValue = attrvalue;
var n = xmlNode.selectSingleNode(path);
//Set the new attribute into the xmlNode
if (n.setAttributeNodeNS)
n.setAttributeNodeNS(attr);
else
n.setAttributeNode(attr);
}
Thanks to "Tomalak" for his help.