Convert XMLDocument to a string in Javascript:
var string = (new XMLSerializer()).serializeToString(xmlobject); alert(string);
Convert a string to XMLDocument in Javascript:
var xmlstring = '<?xml version="1.0"?>/ <root>/ <data>/ <row>/ <cell>Captain</cell>/ <cell>Bryophyllum</cell>/ <cell>Zucchini</cell>/ </row>/ </data>/ </root>'; var xmlobject = (new DOMParser()).parseFromString(xmlstring, "text/xml");
xml对象的text和xml属性在firefox里面都不能用。必须用上面的方法进行转换。