public bool IsAppropriateEndTagToken() { if (_lastStartTag == null) { return(false); } return(_tagPending.Name().Equals(_lastStartTag.Name())); }
public Element Insert(Token.StartTag startTag) { // handle empty unknown tags // when the spec expects an empty tag, will directly hit insertEmpty, so won't generate fake end tag. if (startTag.IsSelfClosing && !Tag.IsKnownTag(startTag.Name())) { Element el = InsertEmpty(startTag); Process(new Token.EndTag(el.TagName())); // ensure we get out of whatever state we are in return(el); } Element element = new Element(Tag.ValueOf(startTag.Name()), _baseUri, startTag.Attributes); Insert(element); return(element); }
public Element InsertEmpty(Token.StartTag startTag) { Tag tag = Tag.ValueOf(startTag.Name()); Element el = new Element(tag, _baseUri, startTag.Attributes); InsertNode(el); if (startTag.IsSelfClosing) { _tokeniser.AcknowledgeSelfClosingFlag(); if (!tag.IsKnownTag()) // unknown tag, remember this is self closing for output { tag.SetSelfClosing(); } } return(el); }
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.IsKnownTag()) // unknown tag, remember this is self closing for output. see above. { tag.SetSelfClosing(); } } else { _stack.AddLast(el); } return(el); }