This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function formatXml(xml) { | |
var formatted = ''; | |
var reg = /(>)(<)(\/*)/g; | |
xml = xml.toString().replace(reg, '$1\r\n$2$3'); | |
var pad = 0; | |
var nodes = xml.split('\r\n'); | |
for(var n in nodes) { | |
var node = nodes[n]; | |
var indent = 0; | |
if (node.match(/.+<\/\w[^>]*>$/)) { |