C# XMLTextWriter include default Namespaces



ow can I define a default namespace in XML using the XMLTextWriter? I want my XML to look like this!



<myXml xmlns:nss="http://my/location/" xmlns:xsi="http://ift.tt/ra1lAU" xmlns="http://my/location/">

xmlTextWriter.WriteStartDocument();
xmlTextWriter.WriteStartElement("myXml");
xmlTextWriter.WriteAttributeString("xmlns", "nss", null, statusNamespace);
xmlTextWriter.WriteAttributeString("xmlns", "xsi", null, xsiSchemaNamespace);


How can I get the xmlns default without any prefix? If I add it to my XML? If I add the following line additionally, I get "the prefix cannot be redefined from to "http://my/location/" "



xmlTextWriter.WriteAttributeString("xmlns", null, null, statusNamespace);

No comments:

Post a Comment