function createXML(pathData) {
var xmlDOM = createXMLDOM(); //参考:http://iceworldvip.blog.51cto.com/5438460/1341677
if (xmlDOM) {
var data = xmlDOM.createElement('MapData');
xmlDOM.appendChild(data);
newEle = xmlDOM.createElement("x");
newText = xmlDOM.createTextNode("100");
newEle.appendChild(newText);
data.appendChild(newEle);
newEle = xmlDOM.createElement("y");
newText = xmlDOM.createTextNode("26");
newEle.appendChild(newText);
data.appendChild(newEle);
newEle = xmlDOM.createElement("path");
newText = xmlDOM.createTextNode(pathData);
newEle.appendChild(newText);
data.appendChild(newEle);
return parserXMLToString(xmlDOM);
}
return;
}
其他操作参考:
http://www.w3school.com.cn/xmldom/index.asp