Opensource XML Editor in Javascript (Use with in extjs Project)
if possible pls provide开发者_开发问答 samples or links also..
Thanks In Advance
I don't have any idea. Here are some pieces of code to begin yours:
Create your XMLDoc from String :
function fromXMLToString(xmlString) {
var xmlDoc = null;
if (window.DOMParser) {
var parser=new DOMParser();
xmlDoc=parser.parseFromString(xmlString,"text/xml");
}
else // IE
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.loadXML(xmlString);
}
return xmlDoc;
}
var someXmlDoc = fromXMLToString("<a><b>1</b><b>2</b></a>") ;
Convert XMLDoc to string :
function fromStringToXML(xmlDoc){
var xmlString = "";
if (window.ActiveXObject){ // IE
xmlString = xmlDoc.xml;
}else{ // others
xmlString = (new XMLSerializer()).serializeToString(xmlDoc);
}
return xmlString;
}
var someXmlString = fromStringToXML(someXmlDoc);
alert(someXmlString);
精彩评论