Пример #1
0
    /// <summary>
    ///     Retrieves the <see cref="TextDocument" /> using the given HTML parser.
    /// </summary>
    /// <param name="parser">The parser used to transform the input into boilerpipe's internal representation.</param>
    /// <returns>The retrieved <see cref="TextDocument" /></returns>
    /// <exception cref="BoilerpipeProcessingException"></exception>
    public TextDocument GetTextDocument(BoilerpipeHtmlParser parser) {
      try {
        parser.Parse(_source);
      } catch (IOException ex) {
        throw new BoilerpipeProcessingException(ex.Message, ex);
      } catch (SAXException ex) {
        throw new BoilerpipeProcessingException(ex.Message, ex);
      }

      return parser.ToTextDocument();
    }
Пример #2
0
        /// <summary>
        ///     Retrieves the <see cref="TextDocument" /> using the given HTML parser.
        /// </summary>
        /// <param name="parser">The parser used to transform the input into boilerpipe's internal representation.</param>
        /// <returns>The retrieved <see cref="TextDocument" /></returns>
        /// <exception cref="BoilerpipeProcessingException"></exception>
        public TextDocument GetTextDocument(BoilerpipeHtmlParser parser)
        {
            try {
                parser.Parse(_source);
            } catch (IOException ex) {
                throw new BoilerpipeProcessingException(ex.Message, ex);
            } catch (SAXException ex) {
                throw new BoilerpipeProcessingException(ex.Message, ex);
            }

            return(parser.ToTextDocument());
        }