using quiniela.Partido; using System; using System.IO; using System.Xml; public class Quiniela { public static void Main ( string[] args ) { XmlTextReader textReader = new XmlTextReader("quiniela.xml"); textReader.Read(); while (textReader.Read() ) { XmlNodeType nType = textReader.NodeType; Console.WriteLine( "Leyendo {0}", textReader.Name ); if ( (nType == XmlNodeType.Element ) && (textReader.Name == "partido") ) { String jcasa, jfuera; jcasa = LeeEquipo( textReader, "casa" ); jfuera = LeeEquipo(textReader, "fuera" ); textReader.Read(); textReader.Read(); string pronostico=""; if ( textReader.Name == "resultado" ) { textReader.Read(); pronostico = textReader.Value; } Partido estePartido = new Partido ( jcasa, jfuera, pronostico ); Console.WriteLine( estePartido.getAsString() ); } } } public static string LeeEquipo( XmlTextReader _reader, string _donde ) { _reader.Read(); _reader.Read(); String juega=""; if ( (_reader.GetAttribute("juega" )==_donde) && (_reader.Name == "equipo") ) { _reader.Read(); juega = _reader.Value; } _reader.Read(); return juega; } }