XML

This example shows how to use the IXmlDataExporter to export a folder with its objects to XML.

IFolder pFolder = Repository.GetFolderByKey("ICR.Data");

XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
using (XmlWriter pXmlWriter = XmlWriter.Create("out.xml", settings))
{
    pXmlWriter.WriteStartElement("D5");

    IXmlDataExporter pExporter = XmlFactory.CreateDataExporter(Repository);
    
    pExporter.Folders.Add(pFolder);

    pExporter.Recursive = true;
    pExporter.IncludeFiles = true;
    
    pExporter.Export(pXmlWriter);

    pXmlWriter.WriteEndElement(); // "D5" 
}