public static string MakeIndex(Pregunta[] list) { string ret = ""; int count=1; foreach (Pregunta p in list){ ret += String.Format ("<a href=\"#faq{0}\">{1}</a><br>\n", count++, p.Question); } return ret; }
public string MakeFAQ(XmlNode node) { string ret= ""; ret += "<h1>FAQ</h1>\n"; XmlNodeList preguntas = node.SelectNodes ("t:item", MakeWeb.nsmgr); Pregunta[] list = new Pregunta [preguntas.Count]; Console.WriteLine ("Numero de elementos en FAQ = "+ preguntas.Count); int count = 0; foreach (XmlNode _n_ in preguntas){ Console.WriteLine ("" + _n_.OuterXml ); list[count++] = new Pregunta (_n_); } ret += Pregunta.MakeIndex(list); ret += "<hr /> \n"; count=1; foreach (Pregunta p in list){ ret += String.Format ( "<a name=\"{0}\"></a>\n<p><b>{1}</b></p>\n<p>{2}</p>\n", count++, p.Question, p.Answer ); } return ret; }