ToString() public method

public ToString ( ) : string
return string
Example #1
0
 Element visit_processing_instruction(Token token)
 {
     Match match = MatchProcessingInstruction.Match(token.ToString());
     Dictionary<string, object> node = Groupdict(MatchProcessingInstruction, match, token);
     return new Element(ElementKind.ProcessingInstruction, node);
 }
Example #2
0
        static Dictionary<string, object> match_tag(Token token)
        {
            Match match = MatchTagPrefixAndName.Match(token.ToString());
            Dictionary<string, object> node = Groupdict(MatchTagPrefixAndName, match, token);

            int end = match.Index + match.Length;
            token = token.Substring(end);

            var attrs = new List<Dictionary<string, object>>();
            node["attrs"] = attrs;

            foreach (Match m in MatchSingleAttribute.Matches(token.ToString()))
            {
                Dictionary<string, object> attr = Groupdict(MatchSingleAttribute, m, token);
                if (attr.Keys.Contains("alt_value"))
                {
                    var altValue = attr["alt_value"] as Token;
                    attr.Remove("alt_value");
                    if (!string.IsNullOrEmpty(altValue.ToString()))
                    {
                        attr["value"] = altValue;
                        attr["quote"] = "";
                    }
                }
                if (attr.Keys.Contains("simple_value"))
                {
                    var simpleValue = attr["simple_value"] as Token;
                    attr.Remove("simple_value");
                    if (!string.IsNullOrEmpty(simpleValue.ToString()))
                    {
                        attr["quote"] = "";
                        attr["value"] = new Token("");
                        attr["eq"] = "";
                    }
                }
                attrs.Add(attr);
                int m_end = m.Index + m.Length;
                node["suffix"] = token.Substring(m_end);
            }

            return node;
        }