public override BaseState Process(HtmlTokenizer tokenizer, StreamReader reader)
        {
            int c = Read(reader);
            if (base.IsUppercaseAsciiLetter(c))
            {
                EndTagToken token = new EndTagToken();
                token.TagName = Char.ToLower((char)c).ToString();
                TagNameState.Instance.Token = token;
                return TagNameState.Instance;
            }

            if (base.IsLowercaseAsciiLetter(c))
            {
                EndTagToken token = new EndTagToken();
                token.TagName = ((char)c).ToString();
                TagNameState.Instance.Token = token;
                return TagNameState.Instance;
            }

            if (c == '>')
            {
                ReportParseError();
                return DataState.Instance;
            }

            if (c == -1)
            {
                ReportParseError();
                return DataState.Instance;
            }

            ReportParseError();
            return BogusCommentState.Instance;
        }
 public override BaseState Process(HtmlTokenizer tokenizer, StreamReader reader)
 {
     int c = Read(reader);
     if (base.IsUppercaseAsciiLetter(c))
     {
         EndTagToken token = new EndTagToken(){ TagName = Char.ToLower((char)c).ToString() };
         //Create a new end tag token, and set its tag name to the lowercase version of the current input
         //character (add 0x0020 to the character's code point).
         //Append the current input character to the temporary buffer. (http://www.w3.org/TR/html5/syntax.html#temporary-buffer)
         //Finally, switch to the RCDATA end tag name state. (Don't emit the token yet;
         //further details will be filled in before it is emitted.)
         tokenizer.TemporaryBuffer.Add((char)c);
         RCDATAEndTagNameState.Instance.Token = token;
         return RCDATAEndTagNameState.Instance;
     }
     if (base.IsLowercaseAsciiLetter(c))
     {
         EndTagToken token = new EndTagToken(){ TagName = ((char)c).ToString() };
         //Create a new end tag token, and set its tag name to the current input character.
         //Append the current input character to the temporary buffer. (http://www.w3.org/TR/html5/syntax.html#temporary-buffer)
         //Finally, switch to the RCDATA end tag name state. (Don't emit the token yet;
         //further details will be filled in before it is emitted.)
         tokenizer.TemporaryBuffer.Add((char)c);
         RCDATAEndTagNameState.Instance.Token = token;
         return RCDATAEndTagNameState.Instance;
     }
     tokenizer.EmitChar('<');
     tokenizer.EmitChar('/');
     LastConsumedCharacters.Enqueue((char)c);
     return RCDATAState.Instance;
 }
Beispiel #3
0
 public RenameElementFix(BeginTagToken tag, string newName, EndTagToken endTag = null)
 {
     Tag     = tag;
     NewName = newName;
     EndTag  = endTag;
 }