Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Xml;
- using System.Xml.Linq;
- public partial class _Default : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- CrearDocumentoXML();
- }
- protected void CrearDocumentoXML()
- {
- try
- {
- XDocument miXml = new XDocument(
- new XDeclaration ("1.0", "utf-8", "yes"),
- new XElement ("empleados",
- new XElement ("listado",
- new XElement ("empleado",
- new XElement ("id", "4884"),
- new XElement ("nombreCompleto", "Rodriguez, Victor"),
- new XElement("cuit", "20103180326"),
- new XElement("sector",
- new XAttribute ("denominacion", "Gerencia Recursos Humanos"),
- new XAttribute ("id", "137"),
- new XAttribute ("valorSemaforo", "130.13"),
- new XAttribute ("colorSemaforo", "VERDE")
- ),
- new XElement("cupoAsignado", "1837.15"),
- new XElement("cupoConsumido", "658.02")
- ),
- new XElement ("empleado",
- new XElement ("id", "1225"),
- new XElement ("nombreCompleto", "Sanchez, Juan Ignacio"),
- new XElement("cuit", "20271265817"),
- new XElement("sector",
- new XAttribute ("denominacion", "Gerencia Operativa"),
- new XAttribute ("id", "44"),
- new XAttribute ("valorSemaforo", "130.13"),
- new XAttribute ("colorSemaforo", "ROJO")
- ),
- new XElement("cupoAsignado", "750.87"),
- new XElement("cupoConsumido", "625.46")
- )
- ),
- new XElement ("subsectores", "5"),
- new XElement ("totalCupoAsignadoSector", "4217.21"),
- new XElement ("totalCupoConsumidoSector", "1405.88"),
- new XElement ("valorDial", "33.34")
- )
- );
- String ruta = Server.MapPath("~");
- string archivoXML = ruta + "\\miXML.xml";
- miXml.Save(@archivoXML);
- }
- catch (Exception ex)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement