unable to create textnode using jQuery without default namespace



I am trying to create text node in xml using jQuery. Below is the code which create text node in xml, but it is creating textnode with default namespace.





function CheckChildNodeExistance(bindName, $xml) {
$xmlNode = $xml.find(bindName);
if ($xmlNode.length <= 0) {
debugger;
var bName = bindName.split(' ');
//$xml.find(bName[0] + ' ' + bName[1]).append('<' + bName[2] + '></' + bName[2] + '>');
//var str1 = $xml.createTextNode(bName[2]); //this line gives me error
//$xml.append(str1);
$xml.append($('<' + bName[2] + '></' + bName[2] + '>'));
}
}



$xml is my jQuery xml object. Output of this method create xml element with default namespace. if you closely look into address node, it has default namespace which is causing the problem. I want to remove this namespace.



<address xmlns="http://ift.tt/lH0Osb" />


Can anybody help me on this





<row><CardCode>ABCDEFGH</CardCode><Name>HO</Name><Position>1</Position><Phone1>1</Phone1><Phone2>1</Phone2><MobilePhone>1</MobilePhone><Fax>1</Fax><E_Mail>1</E_Mail><Pager>1</Pager><Remarks1>1</Remarks1><Remarks2>1</Remarks2><InternalCode>1307</InternalCode><Gender>gt_Undefined</Gender><Active>tYES</Active><FirstName>Manish</FirstName><MiddleName>S</MiddleName><LastName>Chourasia</LastName><address xmlns="http://ift.tt/lH0Osb" /></row>


No comments:

Post a Comment