Add XML Namespace Declaration via XmlDictionaryWriter - CSharp System.Xml

CSharp examples for System.Xml:XML Namespace

Description

Add XML Namespace Declaration via XmlDictionaryWriter

Demo Code

// 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);
            }
        }
}

Related Tutorials