Closed Milad-Darvishi closed 7 years ago
Hi @iranidesign
It's not supported out of the box. You can fork the project and modify the XmlSerializer class and output to a file. I don't see a common use case here so I am not planning to implement it for now.
Way later than from when this issue was opened but I needed this feature, so I forked this and added this feature to write to a physical Xml file: https://github.com/BenjaminMichaelis/DotnetSitemapGenerator The nuget package is here to install to your project is here: https://www.nuget.org/packages/DotnetSitemapGenerator
An example usage is:
IXmlSerializer sitemapProvider = new XmlSerializer();
List<SitemapNode> nodes = new(); // Add in your nodes here
// third parameter (true in this case) is used to mark whether the outputed xml file should
// be formatted in a way that it is easily readable by human eyes which is
// helpful with visual validation
sitemapProvider.Serialize(new SitemapModel(nodes), xmlSavePath, true);
as is documented in the readme
How Can I get Write nodes in xml file?