CodeMirror.defineMode("xml", function (w, k) { var p = w.indentUnit; var v = k.htmlMode ? {autoSelfClosers: {br: true, img: true, hr: true, link: true, input: true, meta: true, col: true, frame: true, base: true, area: true}, doNotIndent: {pre: true}, allowUnquoted: true} : {autoSelfClosers: {}, doNotIndent: {}, allowUnquoted: false}; var a = k.alignCDATA; var f, g; function o(C, B) { function z(E) { B.tokenize = E; return E(C, B) } var A = C.next(); if (A == "<") { if (C.eat("!")) { if (C.eat("[")) { if (C.match("CDATA[")) { return z(u("atom", "]]>")) } else { return null } } else { if (C.match("--")) { return z(u("comment", "-->")) } else { if (C.match("DOCTYPE", true, true)) { C.eatWhile(/[\w\._\-]/); return z(x(1)) } else { return null } } } } else { if (C.eat("?")) { C.eatWhile(/[\w\._\-]/); B.tokenize = u("meta", "?>"); return"meta" } else { g = C.eat("/") ? "closeTag" : "openTag"; C.eatSpace(); f = ""; var D; while ((D = C.eat(/[^\s\u00a0=<>\"\'\/?]/))) { f += D } B.tokenize = n; return"tag" } } } else { if (A == "&") { var y; if (C.eat("#")) { if (C.eat("x")) { y = C.eatWhile(/[a-fA-F\d]/) && C.eat(";") } else { y = C.eatWhile(/[\d]/) && C.eat(";") } } else { y = C.eatWhile(/[\w]/) && C.eat(";") } return y ? "atom" : "error" } else { C.eatWhile(/[^&<]/); return null } } } function n(A, z) { var y = A.next(); if (y == ">" || (y == "/" && A.eat(">"))) { z.tokenize = o; g = y == ">" ? "endTag" : "selfcloseTag"; return"tag" } else { if (y == "=") { g = "equals"; return null } else { if (/[\'\"]/.test(y)) { z.tokenize = j(y); return z.tokenize(A, z) } else { A.eatWhile(/[^\s\u00a0=<>\"\'\/?]/); return"word" } } } } function j(y) { return function (A, z) { while (!A.eol()) { if (A.next() == y) { z.tokenize = n; break } } return"string" } } function u(z, y) { return function (B, A) { while (!B.eol()) { if (B.match(y)) { A.tokenize = o; break } B.next() } return z } } function x(y) { return function (B, A) { var z; while ((z = B.next()) != null) { if (z == "<") { A.tokenize = x(y + 1); return A.tokenize(B, A) } else { if (z == ">") { if (y == 1) { A.tokenize = o; break } else { A.tokenize = x(y - 1); return A.tokenize(B, A) } } } } return"meta" } } var l, h; function b() { for (var y = arguments.length - 1; y >= 0; y--) { l.cc.push(arguments[y]) } } function e() { b.apply(null, arguments); return true } function i(y, A) { var z = v.doNotIndent.hasOwnProperty(y) || (l.context && l.context.noIndent); l.context = {prev: l.context, tagName: y, indent: l.indented, startOfLine: A, noIndent: z} } function s() { if (l.context) { l.context = l.context.prev } } function d(y) { if (y == "openTag") { l.tagName = f; return e(m, c(l.startOfLine)) } else { if (y == "closeTag") { var z = false; if (l.context) { z = l.context.tagName != f } else { z = true } if (z) { h = "error" } return e(q(z)) } } return e() } function c(y) { return function (z) { if (z == "selfcloseTag" || (z == "endTag" && v.autoSelfClosers.hasOwnProperty(l.tagName.toLowerCase()))) { return e() } if (z == "endTag") { i(l.tagName, y); return e() } return e() } } function q(y) { return function (z) { if (y) { h = "error" } if (z == "endTag") { s(); return e() } h = "error"; return e(arguments.callee) } } function m(y) { if (y == "word") { h = "attribute"; return e(m) } if (y == "equals") { return e(t, m) } if (y == "string") { h = "error"; return e(m) } return b() } function t(y) { if (y == "word" && v.allowUnquoted) { h = "string"; return e() } if (y == "string") { return e(r) } return b() } function r(y) { if (y == "string") { return e(r) } else { return b() } } return{startState: function () { return{tokenize: o, cc: [], indented: 0, startOfLine: true, tagName: null, context: null} }, token: function (B, A) { if (B.sol()) { A.startOfLine = true; A.indented = B.indentation() } if (B.eatSpace()) { return null } h = g = f = null; var z = A.tokenize(B, A); A.type = g; if ((z || g) && z != "comment") { l = A; while (true) { var y = A.cc.pop() || d; if (y(g || z)) { break } } } A.startOfLine = false; return h || z }, indent: function (B, y, A) { var z = B.context; if ((B.tokenize != n && B.tokenize != o) || z && z.noIndent) { return A ? A.match(/^(\s*)/)[0].length : 0 } if (a && /