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