예제 #1
0
        public void Parse(InputSource input)
        {
            var document = new HtmlDocument();

            if (input.Stream != null)
            {
                document.Load(input.Stream, input.Encoding);
            }
            else if (input.Reader != null)
            {
                document.Load(input.Reader);
            }
            else if (input.PublicId != null)
            {
                document.Load(input.PublicId);
            }
            else if (input.SystemId != null)
            {
                document.Load(input.SystemId);
            }

            ContentHandler.StartDocument();

            TraverseNode(document.DocumentNode);

            ContentHandler.EndDocument();
        }
예제 #2
0
 /// <summary>Finish visitor</summary>
 /// <exception cref="System.IO.IOException"/>
 public virtual void Close(Exception error)
 {
     try
     {
         contentHandler.EndElement(string.Empty, string.Empty, "EDITS");
         if (error != null)
         {
             string msg = error.Message;
             XMLUtils.AddSaxString(contentHandler, "ERROR", (msg == null) ? "null" : msg);
         }
         contentHandler.EndDocument();
     }
     catch (SAXException e)
     {
         throw new IOException("SAX error: " + e.Message);
     }
     @out.Close();
 }