Because you have wrong values for namespace prefix?
Next time, come up with runnable example like this. This verifies that xmlns
output works:
using System;
using System.Xml;
public class X
{
public static void Main ()
{
string NCXNamespace = nc;
Using System.Xml.XmlWriter, I had a strange problem with writing the
namespace declaration into the file. The line:
writer.WriteAttributeString(xmlns, NCXNamespace,
“http://www.w3.org/2000/xmlns/”, NCXNamespaceURI);
was crashing with the exception:
Invalid attribute namespace for namespace