// injects the namespace mapping at the top private void _injectMapping(XmlNamespaceMap mapping) { if (!StronglyTyped) return; var buffer = new TextBuffer(this); buffer.Indent(); buffer.BeginClause(BplJsonParser.NAMESPACE_ATTR); buffer.Indent("{"); var pairs = mapping.ToArray(); for (int i = 0, N = pairs.Length; i < N; i++) { buffer.BeginClause(pairs[i].Item1); buffer.Append(Quote(pairs[i].Item2.ToString())); buffer.EndClause(i == N - 1); } buffer.Outdent("}"); buffer.EndClause(false); var k = 1; if (PrettyPrint) k += NewLineChars.Length; _output.Insert(k, buffer.ToString()); }