public Artigo(Artigo source) { this.titulo = source.titulo; this.ano = source.ano; this.autores = source.autores; }
private void gatherFromFile(string filename) { Autor test = new Autor(); List <string> tempCitName = new List <string>(); XDocument xdoc = XDocument.Load(filename); try { // id lattes do autor (sempre tem no currículo) xdoc.Descendants("CURRICULO-VITAE").Select(p => new { id = p.Attribute("NUMERO-IDENTIFICADOR").Value }).ToList().ForEach(p => { if (p.id != "") { test.setId(p.id.ToCharArray(0, 16)); } }); // nome do autor e nome em citação, nacionalidade é bonus xdoc.Descendants("DADOS-GERAIS").Select(p => new { name = p.Attribute("NOME-COMPLETO").Value, citName = p.Attribute("NOME-EM-CITACOES-BIBLIOGRAFICAS").Value, nat = p.Attribute("PAIS-DE-NACIONALIDADE").Value }).ToList().ForEach(p => { test.setNome(p.name); test.setNomeCitacao(p.citName.Split(';').ToList()); test.setNacionalidade(p.nat); }); // Adiciona o usuário a lista de usuários a serem processados autors.Add(test); // ************* Artigos ************** \\ // título artigo xdoc.Descendants("ARTIGO-PUBLICADO").Select(p => new { ta = p.Element("DADOS-BASICOS-DO-ARTIGO").Attribute("TITULO-DO-ARTIGO").Value, te = p.Element("DADOS-BASICOS-DO-ARTIGO").Attribute("ANO-DO-ARTIGO").Value, // Autores do Artigo ti = p.Descendants("AUTORES").Select(c => new { name = c.Attribute("NOME-COMPLETO-DO-AUTOR").Value, cit = c.Attribute("NOME-PARA-CITACAO").Value, id = c.Attribute("NRO-ID-CNPQ").Value }).ToList() }).ToList().ForEach(p => { Artigo helper = new Artigo(p.ta, int.Parse(p.te)); p.ti.ForEach(z => { tempCitName = z.cit.Split(';').ToList(); helper.addAutor(new Autor(z.name, tempCitName, z.id.ToCharArray())); }); articles.Add(helper); // adiciona o artigo à lista de manuseio }); } catch (Exception e) { Console.WriteLine(e.Message); } }