Example #1
0
        /// <summary>
        /// Create a processor that writes to the file named and may or may not
        /// also output to the screen, as specified.
        /// </summary>
        /// <param name="filename">Name of file to write output to</param>
        /// <param name="printToScreen">Mirror output to screen?</param>
        /// <exception cref="System.IO.IOException"/>
        public XmlEditsVisitor(OutputStream @out)
        {
            this.@out = @out;
            OutputFormat outFormat = new OutputFormat("XML", "UTF-8", true);

            outFormat.SetIndenting(true);
            outFormat.SetIndent(2);
            outFormat.SetDoctype(null, null);
            XMLSerializer serializer = new XMLSerializer(@out, outFormat);

            contentHandler = serializer.AsContentHandler();
            try
            {
                contentHandler.StartDocument();
                contentHandler.StartElement(string.Empty, string.Empty, "EDITS", new AttributesImpl
                                                ());
            }
            catch (SAXException e)
            {
                throw new IOException("SAX error: " + e.Message);
            }
        }