/// <summary> Get the next node.</summary> /// <returns> The next node in the HTML stream, or null if there are no more nodes. /// </returns> /// <exception cref="ParserException">If an unrecoverable error occurs. /// </exception> public virtual INode NextNode() { ITag tag; IScanner scanner; NodeList stack; INode ret; try { ret = mLexer.NextNode(); if (null != ret) { // kick off recursion for the top level node if (ret is ITag) { tag = (ITag)ret; if (!tag.IsEndTag()) { // now recurse if there is a scanner for this type of tag scanner = tag.ThisScanner; if (null != scanner) { stack = new NodeList(); ret = scanner.Scan(tag, mLexer, stack); } } } } } catch (ParserException pe) { throw pe; // no need to wrap an existing ParserException } catch (System.Exception e) { System.Text.StringBuilder msgBuffer = new System.Text.StringBuilder(); msgBuffer.Append("Unexpected Exception occurred while reading "); msgBuffer.Append(mLexer.Page.Url); msgBuffer.Append(", in nextNode"); // TODO: appendLineDetails (msgBuffer); ParserException ex = new ParserException(msgBuffer.ToString(), e); mFeedback.Error(msgBuffer.ToString(), ex); throw ex; } return(ret); }
/// <summary> /// /// </summary> /// <param name="message"></param> /// <param name="e"></param> public static void Error(System.String message, ParserException e) { g_Callback.Error(message, e); }