예제 #1
0
        public override void Parse()
        {
            if (Xml.ReadState == ReadState.Closed)
            {
                return;
            }

            while (!Xml.EOF && _currentItem == null)
            {
                if (!_inMiddleOfSection)
                {
                    CurrentSection = GetSectionType(Xml.Name);
                }

                if (CurrentSection == Section.Junk)
                {
                    Xml.Read();
                }
                else if (CurrentSection == Section.Unknown)
                {
                    SkipSection();
                }
                else
                {
                    ParseSection();
                }
            }

            if (Xml.EOF)
            {
                Xml.Close();
            }
        }
예제 #2
0
        public bool PrintCrawlSessionToXml()
        {
            XmlWriter Xml;

            try { Xml = XmlWriter.Create(Config.OutputPath); }
            catch { return(false); }

            try
            {
                Xml.WriteStartDocument();
                Xml.WriteStartElement("SITE");
                Xml.WriteAttributeString("url", Config.RemotePath);
                Xml.WriteAttributeString("depth", Config.CrawlerMaxDepth.ToString());
                RootDocument.PrintToXmlRecursive(Xml);
                Xml.WriteEndElement();
                Xml.WriteEndDocument();
                Xml.Close();
                return(true);
            }
            catch
            {
                Xml.Close();
                return(false);
            }
        }
예제 #3
0
 protected override void OnDispose()
 {
     if (_openingElementName != null)
     {
         if (Xml.NodeType == XmlNodeType.EndElement && Xml.Name == _openingElementName)
         {
             Xml.ReadEndElement();
         }
     }
     if (_mustCloseReader)
     {
         Xml.Close();
     }
     _serviceContainer.Dispose();
 }
예제 #4
0
        public override void Parse()
        {
            if (Xml.ReadState == ReadState.Closed)
            {
                return;
            }

            while (!Xml.EOF && _currentItem == null)
            {
                if (!_inMiddleOfSection)
                {
                    CurrentSection = GetSectionType(Xml.Name);
                    if (CurrentSection != Section.Junk)
                    {
                        _worker.ReportProgress(0, "... " + CurrentSection.GetDescription() + " XMLPLUS");
                    }
                }

                if (CurrentSection == Section.Junk)
                {
                    Xml.Read();
                }
                else if (CurrentSection == Section.Unknown)
                {
                    SkipSection();
                }
                else
                {
                    ParseSection();
                }
            }

            if (Xml.EOF)
            {
                Xml.Close();
            }
        }