コード例 #1
0
 private void CheckIfAppendable(Bool encounteredQuery, int state, char ch, Tag tag)
 {
     if (state == TAG_IGNORE_DATA_STATE || state == TAG_BEGIN_PARSING_STATE ||
         state == TAG_IGNORE_BEGIN_TAG_STATE)
     {
         if (ch == '?')
         {
             encounteredQuery.Boolean = true;
         }
         tag.Append(ch);
     }
 }
コード例 #2
0
        public virtual int IncrementCounter(int i, NodeReader reader, int state, Tag tag)
        {
            string nextLine = null;

            if ((state == TAG_BEGIN_PARSING_STATE || state == TAG_IGNORE_DATA_STATE ||
                 state == TAG_IGNORE_BEGIN_TAG_STATE) && i == tag.TagLine.Length - 1)
            {
                // The while loop below is a bug fix contributed by
                // Annette Doyle - see testcase HTMLImageScannerTest.testImageTagOnMultipleLines()
                // Further modified by Somik Raha, to remove bug - HTMLTagTest.testBrokenTag
                int numLinesAdvanced = 0;
                do
                {
                    nextLine = reader.GetNextLine();
                    numLinesAdvanced++;
                } while (nextLine != null && nextLine.Length == 0);
                if (nextLine == null)
                {
                    // This means we have a broken tag. Fill in an end tag symbol here.
                    nextLine = ">";
                }
                else
                {
                    // This means this is just a new line, hence add the new line character
                    tag.Append(Parser.LineSeparator);
                }

                // Ensure blank lines are included in tag's 'tagLines'
                while (--numLinesAdvanced > 0)
                {
                    tag.TagLine = "";
                }

                // We need to continue parsing to the next line
                tag.TagLine = nextLine;
                i           = -1;
            }
            return(++i);
        }