Reputation: 4865
I am attempting to write the following line with C#'s XmlWriter.
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
I seem to only seem have an option to write on xmlns (and then with no :suffix), when using the xmlWriter.WriteStartElement method.
Is it possible to do with XmlWriter?
Upvotes: 0
Views: 642
Reputation: 552
Would this help? Adjusted to use LookupPrefix.
writer = XmlWriter.Create(sw);
writer.WriteStartElement("configuration");
writer.WriteAttributeString("xmlns", "patch", null, "http://www.sitecore.net/xmlconfig/");
writer.WriteAttributeString("xmlns", "set", null, "http://www.sitecore.net/xmlconfig/set/");
writer.WriteEndElement();
writer.Flush();
writer.Close();
outputs:
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/" />
Upvotes: 1