I am using ACE Editor to display xml content on my web page. I want to format the xml code in Editor.
Can Any one tell me how to do this ?
I am using ACE Editor to display xml content on my web page. I want to format the xml code in Editor.
Can Any one tell me how to do this ?
XML Code formatting is not specified in Ace itself, as it's just an editor. Use any of the answers in this question to prettify the code.
var code = ace.getSession().getValue();
// prettify
ace.getSession().setValue(code);
There are numerous modes included in the package and the Wiki at github will tell you how to implement it. Something like this:
var Mode = require('ace/mode/xml').Mode;
editor.getSession().setMode(new Mode());