예제 #1
0
        protected string WriteToStreamAndReturn(ContentItem item)
        {
            IItemXmlWriter writer = CreateWriter();
            StringBuilder  sb     = new StringBuilder();
            StringWriter   sw     = new StringWriter(sb);

            XmlTextWriter xmlOutput = new XmlTextWriter(sw);

            xmlOutput.Formatting  = Formatting.Indented;
            xmlOutput.Indentation = 1;
            xmlOutput.WriteStartDocument();
            xmlOutput.WriteStartElement("n2");

            writer.Write(item, ExportOptions.Default, xmlOutput);

            xmlOutput.WriteEndElement();
            xmlOutput.WriteEndDocument();
            return(sb.ToString());
        }
예제 #2
0
        public virtual void Export(ContentItem item, ExportOptions options, TextWriter output)
        {
            var xmlOutput = new XmlTextWriter(output)
            {
                Formatting = XmlFormatting
            };

            xmlOutput.WriteStartDocument();

            using (var envelope = new ElementWriter("n2", xmlOutput))
            {
                envelope.WriteAttribute("version", GetType().Assembly.GetName().Version.ToString());
                envelope.WriteAttribute("exportVersion", 2);
                envelope.WriteAttribute("exportDate", Utility.CurrentTime());

                itemWriter.Write(item, options, xmlOutput);
            }

            xmlOutput.WriteEndDocument();
            xmlOutput.Flush();
        }