Exemplo n.º 1
0
        /// <summary>
        /// Serializes the <see cref="HtmlContent"/> object to Xml in a format
        /// suitable for import into OneNote.
        /// </summary>
        /// <param name="parentNode">
        /// A reference to the parent XML node that we should serialize ourselves
        /// as a child of.
        /// </param>
        protected internal override void SerializeToXml(XmlNode parentNode)
        {
            XmlDocument xmlDocument = parentNode.OwnerDocument;

            XmlElement htmlElement = xmlDocument.CreateElement("Html");

            parentNode.AppendChild(htmlElement);

            // Clean our HTML:
            if (HtmlData is StringData)
            {
                Data tidyHtmlData = (Data)HtmlData.Clone();
                tidyHtmlData.data = CleanHtml(HtmlData.data);

                tidyHtmlData.SerializeToXml(htmlElement);
            }
            else
            {
                // TODO: Read the file data into memory and clean it as well:
                HtmlData.SerializeToXml(htmlElement);
            }
        }