using System; using System.IO; using System.XML; public class Quiniela { public static void Main ( string[] args ) { String JEnCasa = args[0]; String JFuera = args[1]; String Pronostico = args[2]; XmlDocument xmlDom = new XmlDocument(); xmlDom.AppendChild( xmlDom.CreateElement("", "quiniela", "")); XmlElement xmlRoot = xmlDom.DocumentElement; XmlElement partido, jcasa, jfuera, pronos; partido = xmlDom.CreateElement( "", "partido", "" ); // Elemento jcasa = xmlDom.CreateElement( "", "equipo", "" ); jcasa.SetAttribute( "juega", "casa" ); XmlText texto; texto= xmlDom.CreateTextNode( arg[0] ); jcasa.AppendChild( texto ); partido.AppendChild( jcasa ); jfuera = xmlDom.CreateElement( "", "equipo", "" ); jfuera.SetAttribute( "juega", "fuera" ); texto= xmlDom.CreateTextNode( arg[0] ); jfuera.AppendChild( texto ); partido.AppendChild( jfuera ); // Pronostico pronos = xmlDom.CreateElement( "", "pronostico", "" ); texto= xmlDom.CreateTextNode( arg[2] ); pronos.AppendChild( texto ); partido.AppendChild( pronos ); // Se añade al raíz xmlRoot.AppendChild( partido ); // Se escribe Console.WriteLine( xmlDom.InnerXml ); } }