Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Configuration;
- using System.Data;
- using System.Linq;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.HtmlControls;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Xml.Linq;
- using System.Xml;
- using System.Text;
- public partial class EscribirXMLTextWriter : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- String ruta = Server.MapPath("~");
- escribirXML(ruta);
- }
- public void escribirXML(string ruta)
- {
- XmlTextWriter myXmlTextWriter = new XmlTextWriter(ruta + "\\miXmlTextWriter.xml", null);
- myXmlTextWriter.Formatting = Formatting.Indented;
- myXmlTextWriter.WriteStartDocument(false);
- myXmlTextWriter.WriteStartElement("empleados");
- myXmlTextWriter.WriteStartElement("listado");
- myXmlTextWriter.WriteStartElement("empleado");
- myXmlTextWriter.WriteElementString("id", "4884");
- myXmlTextWriter.WriteElementString("nombreCompleto", "Rodriguez, Victor");
- myXmlTextWriter.WriteElementString("cuit", "20103180326");
- myXmlTextWriter.WriteStartElement("sector");
- myXmlTextWriter.WriteAttributeString("denominacion", "Gerencia Recursos Humanos");
- myXmlTextWriter.WriteAttributeString("id", "137");
- myXmlTextWriter.WriteAttributeString("valorSemaforo", "130.13");
- myXmlTextWriter.WriteAttributeString("colorSemaforo", "VERDE");
- myXmlTextWriter.WriteEndElement();
- myXmlTextWriter.WriteElementString("cupoAsignado", "1837.15");
- myXmlTextWriter.WriteElementString("cupoConsumido", "658.02");
- myXmlTextWriter.WriteEndElement();
- myXmlTextWriter.Flush();
- myXmlTextWriter.WriteStartElement("empleado");
- myXmlTextWriter.WriteElementString("id", "1225");
- myXmlTextWriter.WriteElementString("nombreCompleto", "Sanchez, Juan Ignacio");
- myXmlTextWriter.WriteElementString("cuit", "20271265817");
- myXmlTextWriter.WriteStartElement("sector");
- myXmlTextWriter.WriteAttributeString("denominacion", "Gerencia Operativa");
- myXmlTextWriter.WriteAttributeString("id", "44");
- myXmlTextWriter.WriteAttributeString("valorSemaforo", "130.13");
- myXmlTextWriter.WriteAttributeString("colorSemaforo", "ROJO");
- myXmlTextWriter.WriteEndElement();
- myXmlTextWriter.WriteElementString("cupoAsignado", "750.87");
- myXmlTextWriter.WriteElementString("cupoConsumido", "625.46");
- myXmlTextWriter.WriteEndElement();
- myXmlTextWriter.WriteEndElement();
- myXmlTextWriter.WriteElementString("subsectores", "5");
- myXmlTextWriter.WriteElementString("totalCupoAsignadoSector", "4217.21");
- myXmlTextWriter.WriteElementString("totalCupoConsumidoSector", "1405.88");
- myXmlTextWriter.WriteElementString("valorDial", "33.34");
- myXmlTextWriter.WriteEndElement();
- myXmlTextWriter.Flush();
- myXmlTextWriter.Close();
- Console.ReadLine();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement