public void SaveToXml(XmlElement xml) { if (m_title != null) { xml.SetAttribute("title", m_title); } foreach (var child in m_children) { var x = xml.AddChild("Node"); child.SaveToXml(x); } foreach (var page in Pages) { var x = xml.AddChild("Page"); page.SaveToXml(x); } if (m_icon != null) { xml.AddChild("Icon").InnerText = IOTool.ImageToText(m_icon); } }