示例#1
0
        /// <summary>
        /// Builds the zone tree
        /// </summary>
        /// <param name="classifiedDoc">The classified html document</param>
        /// <returns>
        /// a zone tree
        /// </returns>
        public ZoneTree Build(SerializableDocument classifiedDoc)
        {
            try
            {
                _currentId = 0;
                var bodyZone    = new Zone(_currentId, null);
                var bodyElement = (SerializableElement)classifiedDoc.Body;
                bodyZone.AddElement(bodyElement);
                this.Build(bodyZone);

                this.CropZoneText(bodyZone, classifiedDoc.Text);
                this.SetDisplayOrder(bodyZone);
                var tree = new ZoneTree(bodyZone, classifiedDoc);

                this.RunPostProcessingSteps(tree);

                return(tree);
            }
            catch (Exception ex)
            {
                throw new Exception("Error building zone tree", ex);
            }
        }