=== From Body ===
var xmlStringConverterObj = new xmlStringConverter();
var metaData_String = xmlStringConverterObj.xmlToString(this is xml object location);
==== From JS File ===
xmlStringConverter = function () {
this.browserOption = "";
if (window.ActiveXObject) {
this.browserOption = 0;
} else {
this.browserOption = 1;
}
}
xmlStringConverter.prototype = {
xmlToString: function(xmlObj) {
var result = "";
if (this.browserOption == 0)
{
result = xmlObj.xml;
} else {
result = (new XMLSerializer()).serializeToString(xmlObj);
}
return result;
},
stringToXml: function(stringObj) {
var result;
var xmlObj;
if (this.browserOption == 0)
{
xmlObj = new ActiveXObject("Microsoft.XMLDOM");
xmlObj.async = false;
xmlObj.loadXML(stringObj);
} else {
var parser=new DOMParser();
xmlObj = parser.parseFromString(stringObj,"text/xml");
}
return xmlObj;
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment