C# & Linq Functional Style – Simple XML Parsing

With things like this, C# is regaining my attention. Parse a simple XML to a string array containing only the child elements defined in an other string array:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace PruebaLinqFuncional
{
    class Program
    {
        public static List ParseXML(string xml, string objectName, string[] dataToParse)
        {
            //Programacion funcional en C# :O

            /*
            return XDocument.Parse(xml).Descendants(objectName).Select((element) =>
            {
                var lst = new List();
                foreach (string field in dataToParse)
                    lst.Add(element.Element(field).Value);
                return lst.ToArray();
            }).ToList();
             */

            return XDocument.Parse(xml).Descendants(objectName).Select( (element) =>
            {
                return dataToParse.Select( (field) => 
                { 
                    return element.Element(field).Value; 
                }).ToArray();
            }).ToList();
        }

        static void Main(string[] args)
        {
            var xml = @"

  string-value
  string-value
  int-value
  string-value
  
    
      Mi_URL_Uno
      Mi_Blob_Uno
      date/time-value
      etag
      size-in-bytes
      blob-content-type
      
      
    
    
      Mi_URL_Dos
      Mi_Blob_Dos
      date/time-value
      etag
      size-in-bytes
      blob-content-type
      
      
    
  
  
    blob-prefix
  
  
";


            foreach (var stra in ParseXML(xml, "Blob", new string[] { "Url", "Name" }))
                Console.WriteLine(string.Join(",", stra));

            Console.ReadLine();
        }
    }
}

Partidos pol????ticos y Web Servers

Para lo que vale, ahora que estamos a unos días de las elecciones y que al fin se callaron las campañas, aquí va una lista de los Web Servers usados por cada partido (afortunadamente ahora ya solo tienen una página de inicio cumpliendo con la ley electoral):

PAN: Microsoft-IIS/6.0 / ASP.NET

PRI: Microsoft-IIS/6.0 / ASP.NET

PRD: Apache/2.2.9 (Fedora) – PHP/5.2.6

PVEM: Apache/2.2.6 (Fedora) 

PT: Apache

Nueva Alianza: Apache/2.0.52 (CentOS)

Convergencia: Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8b mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage

/5.0.2.2635 PHP/5.2.5

PSD: ngnix/0.5.32