CSharp examples for System.Xml:XML Namespace
Add XML Namespace Declaration via XmlDictionaryWriter
// The .NET Foundation licenses this file to you under the MIT license. using System.Xml; using System.Text; public class Main{ internal static void AddNamespaceDeclaration(XmlDictionaryWriter writer, string prefix, XmlDictionaryString ns) {/*ww w . j a v a 2s.c o m*/ string p = writer.LookupPrefix(ns.Value); if (p == null || p != prefix) { writer.WriteXmlnsAttribute(prefix, ns); } } }