Ejemplo n.º 1
0
 internal Element InsertEmpty(Token.StartTag startTag)
 {
     Tag tag = Tag.ValueOf(startTag.Name());
     Element el = new Element(tag, baseUri, startTag.attributes);
     InsertNode(el);
     if (startTag.IsSelfClosing())
     {
         if (tag.IsKnown)
         {
             if (tag.IsSelfClosing)
             {
                 tokeniser.AcknowledgeSelfClosingFlag();
             }
         }
         else
         {
             // if not acked, promulagates error
             // unknown tag, remember this is self closing for output
             tag.SetSelfClosing();
             tokeniser.AcknowledgeSelfClosingFlag();
         }
     }
     // not an distinct error
     return el;
 }
Ejemplo n.º 2
0
 internal Element Insert(Token.StartTag startTag)
 {
     Tag tag = Tag.ValueOf(startTag.Name());
     // todo: wonder if for xml parsing, should treat all tags as unknown? because it's not html.
     Element el = new Element(tag, baseUri, startTag.attributes);
     InsertNode(el);
     if (startTag.IsSelfClosing())
     {
         tokeniser.AcknowledgeSelfClosingFlag();
         if (!tag.IsKnown)
         {
             // unknown tag, remember this is self closing for output. see above.
             tag.SetSelfClosing();
         }
     }
     else
     {
         stack.AddLast(el);
     }
     return el;
 }
Ejemplo n.º 3
0
 internal Element Insert(Token.StartTag startTag)
 {
     // handle empty unknown tags
     // when the spec expects an empty tag, will directly hit insertEmpty, so won't generate this fake end tag.
     if (startTag.IsSelfClosing())
     {
         Element el = InsertEmpty(startTag);
         stack.AddLast(el);
         tokeniser.Transition(TokeniserState.Data);
         // handles <script />, otherwise needs breakout steps from script data
         tokeniser.Emit(new Token.EndTag(el.TagName));
         // ensure we get out of whatever state we are in. emitted for yielded processing
         return el;
     }
     Tag tag = Tag.ValueOf(startTag.Name());
     Element el_1 = new Element(tag, baseUri, startTag.attributes);
     Insert(el_1);
     return el_1;
 }