public static void Parse(this IParseAttributeToken_Parse element, string etag) { var Source = element.Context.Source; var element_start = Source.IndexOf("<" + etag); var attributes_start = Source.IndexOf(" ", element_start); var attibutes_end = Source.IndexOf(">", element_start); var tag = ""; var element_fast_end = -1; if (attributes_start < attibutes_end) { if (attributes_start < 0) { return; } tag = Source.Substring(element_start + 1, attributes_start - element_start - 1); // seek for attributes element.AttributeHandler.InternalParseAttributes(Source.Substring(attributes_start, attibutes_end - attributes_start)); element_fast_end = Source.IndexOf("/>", attributes_start); } else { if (attibutes_end < 0) { return; } tag = Source.Substring(element_start + 1, attibutes_end - element_start - 1); element_fast_end = Source.IndexOf("/>", attibutes_end); // seek for no attributes } var element_end = Source.IndexOf("</" + tag, attibutes_end); if (element_fast_end >= 0) { if (element_end < 0) { return; } } // we are unable to find the closing tag // as we do not care about the content we could // just ignore this and return if (element.SetValue == null) { if (element_end < 0) { return; } } var content = Source.Substring(attibutes_end + 1, element_end - attibutes_end - 1); element.SetValue(content); }
public static void Parse(this IParseAttributeToken_Parse element) { Parse(element, ""); }