开发者

Opensource XML Editor in Javascript (Use with in extjs Project)

开发者 https://www.devze.com 2023-01-31 03:14 出处:网络
I am new to extjs , i need to know is there any good xml editor or viewer in extjs itself or any other Opensource XML Editor component in JavaScript is available to use along with extjs.

I am new to extjs , i need to know is there any good xml editor or viewer in extjs itself or any other Opensource XML Editor component in JavaScript is available to use along with extjs.

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);
0

精彩评论

暂无评论...
验证码 换一张
取 消