CSharp examples for System.Xml:XML Namespace
Ensure XML Namespace Defined
// The .NET Foundation licenses this file to you under the MIT license. using System.Xml; using System.Text; public class Main{ internal static string EnsureNamespaceDefined(XmlDictionaryWriter writer, XmlDictionaryString ns, string defaultPrefix) {//from w w w . ja va 2s . c o m string p = writer.LookupPrefix(ns.Value); if (p == null) { writer.WriteXmlnsAttribute(defaultPrefix, ns); p = defaultPrefix; } return p; } }