public Token(TokenType tokenType, ReadOnlyMemory <char> textValue, int blockLevel, HtmlElementType htmlElementType = HtmlElementType.None) { TokenType = tokenType; BlockLevel = blockLevel; Value = textValue; HtmlElementType = htmlElementType; }
public static HtmlNode Parent(this HtmlNode node, HtmlElementType nodeType) { if (node.Name.ToLower() == nodeType.ToString().ToLower()) return node; if (node.Name.ToLower() == "body" || node.ParentNode == null) return null; return Parent(node.ParentNode, nodeType); }
public HtmlElement(HtmlNodeType nodeType, HtmlElementType type, string attributesAsString, bool isEmpty, int characterPosition) { this.m_nodeType = nodeType; this.m_elementType = type; this.m_isEmptyElement = isEmpty; this.m_characterPosition = characterPosition; if (!string.IsNullOrEmpty(attributesAsString)) { this.m_attributesAsString = attributesAsString; } }
public static IList<HtmlNode> Find(this HtmlNode node, HtmlElementType nodeType) { if (node.Name.ToLower() == nodeType.ToString().ToLower()) return new List<HtmlNode> { node }; var list = new List<HtmlNode>(); foreach (var childNode in node.ChildNodes) list.AddRange(Find(childNode, nodeType)); return list; }
public static HtmlElement GetElement(HtmlElementType type) { HtmlElement ret; if (elementPool.Count > 0) ret = elementPool.Pop(); else ret = new HtmlElement(); ret.type = type; if (type != HtmlElementType.Text && ret.attributes == null) ret.attributes = new Hashtable(); return ret; }
public TextorizeState(StringBuilder @out, Token currentToken, int currentBlockDepth, HtmlElementType inHtmlElement, Token previousToken) { Out = @out; CurrentToken = currentToken; CurrentBlockDepth = currentBlockDepth; InHtmlElement = inHtmlElement; PreviousToken = previousToken; PreDepth = 0; ListDepth = 0; }
public HtmlElement(string name = null, Dictionary <string, string> attributes = null, List <HtmlElement> children = null, string innerHtml = null, HtmlElementType type = 0) { Name = name; try { InnerHtml = S1Resource.HttpUtility.HtmlDecode(innerHtml); } catch (Exception) { InnerHtml = innerHtml; } Attributes = new HtmlAttributeCollection(attributes); Children = children ?? new List <HtmlElement>(); Type = type; }
public static HtmlElement GetElement(HtmlElementType type) { HtmlElement ret; if (elementPool.Count > 0) { ret = elementPool.Pop(); } else { ret = new HtmlElement(); } ret.type = type; if (type != HtmlElementType.Text && ret.attributes == null) { ret.attributes = new Hashtable(); } return(ret); }
public HtmlElement(HtmlNodeType nodeType, HtmlElementType elemntType, string value, int characterPosition) : this(nodeType, elemntType, null, false, characterPosition) { this.m_value = value; }
public HtmlElement(HtmlNodeType nodeType, HtmlElementType elemntType, int characterPosition) : this(nodeType, elemntType, null, true, characterPosition) { }
private static Token CreateToken(TokenType tokenType, HtmlElementType htmlElementType, in SourceScanState state)
internal HtmlElement(HtmlNodeType nodeType, HtmlElementType elemntType, string value, int characterPosition) : this(nodeType, elemntType, null, isEmpty : false, characterPosition) { m_value = value; }
internal HtmlElement(HtmlNodeType nodeType, HtmlElementType elemntType, int characterPosition) : this(nodeType, elemntType, null, isEmpty : true, characterPosition) { }